Bale bundled Real into an early lead, before Borja Mayoral took advantage of more sloppy defending to make it two before half-time.
Serbian Darko Brasanac gave Leganes hope of a comeback, but Real closed out the victory despite struggling in the second half.
“I’m very happy with the attitude of my players today, with 10 changes to the starting eleven, with players who haven’t played much,” said Real coach Zinedine Zidane.
“We can’t be happy with what we’ve done in the league in general. We lost a lot of points at the beginning, then we were a bit better but that can happen in a season.
“Now we have to get back to work, we have another match on Tuesday which will be our game of the year. We have a title to defend.”
Real stay third in the table, one point behind city rivals Atletico who play Alaves on Sunday, when Barcelona can secure the La Liga title if they avoid defeat at Deportivo La Coruna.
Zidane made sweeping changes to the team which beat Bayern 2-1 in Wednesday’s first leg at the Allianz Arena, with Bale and Karim Benzema returning.
Bale boosted his hopes of a start in the second leg by hooking in a deflected Benzema effort to give Real an eighth-minute lead with his first goal since a double against Las Palmas on 31 March.
Leganes had stunned Real with a 2-1 victory at the Santiago Bernabeu in January to reach the Copa del Rey semi-finals, but struggled to make any inroads against their dominant hosts.
Daniel Ceballos fired narrowly over, but the soon-to-be deposed league champions doubled their advantage on the stroke of half-time.
Mayoral tapped in from close range after Leganes goalkeeper Pichu Cuellar totally missed a left-wing cross, with offside appeals waved away as defender Unai Bustinza had got a touch to the ball on its way through.
It was the 21-year-old Mayoral’s second La Liga goal, having also netted against Real Sociedad in September.Leganes grew into the game after the break as Real’s thoughts perhaps turned towards Bayern, and Miguel Guerrero wasted an excellent chance to halve the deficit as he headed wide from a Nabil El Zhar cross.
But the away team did pull one back in the 66th minute, as Nordin Amrabat forced his way to the byline and squared for Brasanac to tap in from close range.
On-loan Watford winger Amrabat was proving dangerous, and the Moroccan saw a low shot saved by stand-in Real goalkeeper Kiko Casilla.
Leganes continued to pile on the pressure, with Casilla making a brilliant stop to deny Bustinza.Leganes defender Gabriel sent off in injury-time, as Real clung on for the three points after a below-par performance.
Own-goal double settles Basque derby
Earlier on Saturday, Athletic Bilbao midfielder Mikel San Jose scored two own goals as his side slipped to a 3-1 defeat at Real Sociedad in Saturday’s Basque country derby.
The 28-year-old volleyed a corner emphatically past his own goalkeeper Kepa Arrizabalaga in the 15th minute, before Mikel Oyarzabal doubled the advantage before half-time.
San Jose became only the second player to ever score two own goals in a La Liga match at the Anoeta Stadium, putting through his own net early in the second half before Raul Garcia scored a consolation from the penalty spot.
Elsewhere, Carlos Bacca scored a 25-minute hat-trick as sixth-placed Villarreal claimed a 4-1 victory over Celta Vigo.
The Colombian striker broke the deadlock in the 13th minute and tapped in to complete his hat-trick seven minutes before half-time and score his 18th goal of the season.
Sevilla sacked coach Vincenzo Montella after just four months in charge after seeing their winless run extended to nine games with a 2-1 loss at lowly Levante on Friday.It was the second time the Italian had been sacked this season, after being dumped by AC Milan last November.