Los Blancos scored in the last minute in the first leg, as Marco Asensio found the net after a lacklustre display by the La Liga and UEFA Champions League holders.
Leganes have impressed this term, with the Cucumber Growers comfortable in mid-table in the top flight.
Here is how you can watch the battle for a place in the last four:
Date: Wednesday, Jan. 24
Time: 8:30 p.m. (GMT)/3:30 p.m. (ET)
TV: beIN Sports (U.S.)
Real are back on form after slaying Deportivo La Coruna 7-1 in La Liga, with Gareth Bale and Cristiano Ronaldo displaying an eye for goal once again.
However, Real manager Zinedine Zidane has rested his primary players in the Copa, but it will be no surprise to see a bench laden with superstars for the second leg.
Leganes have just a short journey to the Santiago Bernabeu Stadium, and they will be a dangerous opponent if the hosts refuse to move through the gears.
The visitors have seven wins and four draws in La Liga this term, and they have become a mean outfit, conceding only 19 goals in the league.
Real have conceded just one less, setting up an intriguing encounter with a side based on the outskirts of the Spanish capital.
It has been a very difficult period for Zidane, and his side have appeared short of motivation and attacking vigour since the start of the campaign.
That all changed as Depor arrived in town, and the visiting party was soundly dismantled as Bale took centre stage.
The Welshman scored twice as the three points were secured, with the attacker finishing a glorious curling effort with his left foot.
Bale could feature as he battles his way back to full match fitness, with the cup offering the player the chance of additional minutes.
Asensio led the line with fellow prodigy Borja Mayoral in the first leg, and both players have good chances to grab starts once again.
Mayoral featured in the starting XI in the win against Depor, with Zidane leaving Karim Benzema on the bench to accommodate him.
Leganes showed endeavour as they fought back against Alaves away from home in La Liga on Sunday, overturning a two-goal deficit to earn a share of the points.
Dimitrios Siovas anchored the defence for Leganes in the first leg and in the 2-2 draw at Alaves, and the centre-back will be key at the Bernabeu.
The 29-year-old has featured in 14 games in La Liga and the Copa this term and will be put under pressure by Real's young attackers.
It should be a simple night for the hosts, but they are playing a stubborn opponent who will be dreaming of a place in the last four.
Zidane's priority isn't the Copa, but with La Liga currently out of their reach, the competition could offer the giants welcome silverware.
The tie is in the balance, and if Leganes can hold Real until the latter stages of the game, they have a puncher's chance of a knockout blow at the conclusion.