Jude Bellingham rescued Real Madrid with a stoppage-time winner against Getafe at the Santiago Bernabeu.
Former Real striker Borja Mayoral had given the visitors a shock lead on 11 minutes.
Joselu equalised early in the second half and after piling on the pressure Bellingham completed the turnaround five minutes into added time.
Madrid’s fourth win in four games puts them five points clear at the top of La Liga.
Getafe did not include on-loan Manchester United striker Mason Greenwood in their squad after his arrival on Friday, and started well when Mayoral opened the scoring, rounding Kepa Arrizabalaga and finishing emphatically despite Antonio Rudiger’s best efforts to recover.
England midfielder Bellingham thought he’d won Real a penalty midway through the first half but VAR reversed the decision, before Luka Modric saw a header tipped over the bar.
It took just two second-half minutes and a lengthy VAR check for Joselu to level as he fired in from close range after the ball fell kindly from a sumptuous Modric cross.
With Madrid frantically searching for a winner, Bellingham pounced after David Soria spilled Nacho’s shot to secure a fortuitous victory for Carlo Ancelotti’s side.
The 20-year-old’s first goal at the Bernabeu means he has scored in every game so far this season, and is La Liga’s top scorer with five goals.
The match was also the first played under a retractable roof at the stadium, with Real starting the season with three away games while the building work was completed.