Karim Benzema scored in the 89th minute to earn Real Madrid a dramatic 3-2 win at home to LaLiga's bottom side Huesca in Zinedine Zidane's second match since his return.
With Luka Modric, Toni Kroos, Raphael Varane, Marco Asensio, Vinicius Junior and Dani Carvajal all out, Luca Zidane started in goal and Brahim Diaz made his full league debut for Madrid.
Huesca took an early lead against the understrength side named by the senior Zidane, with Cucho Hernandez beating the coach's son, but Isco equalised before half-time.
Huesca had never played a competitive game at the Santiago Bernabeu before but they were ahead in the third minute.
Chimy Avila got the better of Nacho Fernandez on the right wing to pull back a low cross that Hernandez finished well.
Isco had been whistled after a loose pass and provided a fitting response when he equalised in the 25th minute.
Benzema sent Brahim Diaz clear then directed the youngster's return pass at goal, Roberto Santamaria making the save, but Diaz squared the rebound for Isco to tap home.
Santamaria was beaten again in the 62nd minute, Ceballos touching in at the back post after Benzema headed a Gareth Bale cross back into the danger zone.
Bale should have extended Madrid's lead, but he somehow miscued a close-range effort over the crossbar from Alvaro Odriozola's centre, and instead Huesca levelled it up.
Madrid were caught out by a short corner and Etxeita arrived behind Bale to steer home Moi Gomez's cross.
Huesca sensed an upset but were left broken-hearted at the death as Benzema capped a fine individual display with an excellent curling finish.
Work to do for Zizou
With Madrid virtually certain to seal Champions League qualification but 12 points behind leaders Barcelona, there is very little for them to play for in the remaining weeks of the season.
While that gives Zinedine Zidane time to assess his squad ahead of the 2019-20 campaign, motivation will prove difficult with nothing at stake and this seemed the case for much of Sunday's clash.
For Huesca, a seven-point gap to safety with nine games to go after their third straight LaLiga loss means the fate of Francisco Rodriguez's side is almost sealed.