
Gonzalo Garcia was making his third substitute appearance for Real Madrid
Real Madrid needed an injury-time winner from rookie Gonzalo Garcia to beat Leganes in the Copa del Rey quarter-final.
Carlo Ancelotti's side had looked in control, taking a 2-0 lead within 25 minutes.
Luka Modric, 39, extended his record as the club's oldest goalscorer with a good finish from Rodrygo's pass.
Brazilian teenager Endrick added a second.
Juan Cruz scored twice to pull Leganes level, the first from a penalty and the second a deflected strike.
But 20-year-old Garcia came on with eight minutes to go for his first appearance of the season and headed in Brahim Diaz's cross.
Garcia has scored 19 goals in 21 third-tier games for Real Madrid's B team this season.