Karim Benzema saved Real Madrid's blushes by scoring a superb late goal to snatch a 3-2 win at home to La Liga basement side Huesca on Sunday and keep up coach Zinedine Zidane's perfect start since the Frenchman returned to the club.
The last-gasp win left Madrid third in the standings with 57 points after 29 games, while second-placed Atletico Madrid have 59 and runaway leaders Barcelona are on 69.
Huesca took a shock lead in the third minute of their first league visit to the Bernabeu when Cucho Hernandez smashed a cross from Ezequiel Avila past goalkeeper Luca Zidane, who was surprisingly brought into the team by his father.
Luca, who is the No. 1 goalkeeper for Real Madrid's reserve side Castilla, was completely discarded by Zidane's successor Julen Lopetegui, who did not include him in the matchday squad for a single game.
- Real Madrid Player Ratings: Benzema stars, young Diaz impresses
He also failed to play any first team football under Real's next coach Santiago Solari -- although he was named on the substitutes bench for four games in January, when Thibaut Courtois and then Keylor Navas were out.
"I am happy for him, for his debut here, with a victory," Zidane senior said after the match. "I was not picking my son, but a player in Real Madrid's squad. I see him as one other player for the team. Luca is the third keeper here. Thibaut was out and I wanted to give Keylor a rest after playing with his country. It came out well."
Madrid drew level in the 25th when Isco knocked home a cross from full debutant Brahim Diaz to score for the second time in two games since being brought back into the team by Zidane, having been frozen out by olari.
Real went ahead after the hour mark with an acrobatic finish from close range by Dani Ceballos and Gareth Bale should have clinched victory when he slid in to meet a cross from a few metres out but somehow sent the ball over the bar.
Huesca were always threatening and seized their moment in the 74th with a short corner routine, Xabier Etxeita equalising with an unorthodox header.
But Madrid averted an embarrassing slip-up thanks to his compatriot Benzema, who curled the ball into the top corner in the 89th.
"It was a crazy game but great for those who came to watch it," Zidane told reporters.
"We suffered a lot but you have to congratulate our opponents for how they played, they are bottom and they put in a great performance. They were causing us problems right until the end but we got a good result which we needed for our morale."
The defeat left Huesca rooted to the bottom of the table on 22 points, seven away from escaping the relegation zone.
Information from Reuters was used in this report.