Los Blancos entered the match as the overwhelming favourites to progress to the final eight, having recorded a 3-0 victory when the pair met at the Bernabeu in the first leg last week.
Martin Braithwaite's first-half goal saw Leganes record a 1-0 victory on the night, but Madrid advanced to the quarter-finals courtesy of a 3-1 aggregate success.
However, when considering the club's injury list, head coach Santiago Solari could still send a strong and indeed experienced XI onto the field which included the likes of Raphael Varane, Casemiro, Marcelo, Lucas Vazquez and Isco.
Vinicius Junior has been a shining light for Madrid in recent weeks and the Brazilian was again included, operating as the central attacker for the reigning European champions.
It has been a turbulent campaign for Madrid, who sacked Julen Lopetegui following a poor start to the campaign. They are all but out of the title race due to Barcelona's current form, but the Copa del Rey does provide a genuine chance to land some domestic silverware, which has been hard for the club to find in recent years.
Not too much occurred in the opening 20 minutes of the second leg. Siovas had another half-chance when he met a cross from Juanfran, but the defender's header was always moving wide of the post.
Leganes were having the majority of the play and another opportunity arrived in the 22nd minute when Juanfran delivered another dangerous cross towards Gerard Gumbau, but the number six missed a free header inside the box.
Sabin Merino was next to come close during a strong period for the home side, but the forward nodded wide of the post from close range as Madrid escaped another dangerous moment.
Leganes did make the breakthrough in the 30th minute, however, when on-loan Middlesbrough attacker Braithwaite converted from close range after seeing his initial header smash off the woodwork.
It was no more than the hosts deserved for their application in the first period, but the final opportunity of the opening half came for Madrid, with Vinicius just missing the post with a low strike in the 41st minute.
There was more urgency about the away side's work early in the second period, with Vinicius curling just wide of the Leganes goal in the 47th minute as the European champions looked for a leveller.
Vinicius was comfortably Real's best player on the night and the Brazilian, who could lead the line against Sevilla this weekend, fired another powerful attempt over the crossbar 25 minutes from time.
Leganes put so much into the first period that it was always going to be difficult to show the same level of intensity in the second and Madrid were the team dominating as the clock ticked on.
Isco was eventually replaced in the 68th minute, however, and it could be some time before the Spaniard is given another starting position as he continues to struggle for form.
Leganes had two brilliant chances to score a second five minutes from time, but Braithwaite saw his close-range header saved by Navas before Sabin fired over the crossbar moments later.
As it transpired, Braithwaite's first-half goal gave Leganes a famous win on the night, but Madrid, who hit a post late on through Brahim Diaz and survived a nervy final 60 seconds, progressed to the quarter-finals courtesy of a 3-1 aggregate victory.
Real will now switch their attention to Saturday's huge La Liga clash against Sevilla, while Leganes will continue their league campaign away to Barcelona on Sunday night.
LEGANES (5-3-2): Pichu; Kravets (Silva 75'), Siovas, Omeruo, Bustinza (En Nesyri 70'), Juanfran; Gumbau (Jose 63'), Recio, Eraso; Merino, Braithwaite
REAL MADRID (4-3-3): Navas; Odriozola, Varane, Nacho, Reguilon (Ceballos 46'); Valverde, Casemiro, Marcelo; Vazquez (Diaz 86'), Vinicius, Isco (Gonzalez 68')