Cristiano Ronaldo ended a barren scoring run in La Liga by striking late to give Real Madrid a 2-1 win at neighbours Getafe on Saturday, preventing what would have been a costly and embarrassing draw for the Spanish and European champions.
The prolific Portuguese had endured a frustrating afternoon in front of the net and had earlier somehow missed an open goal but he made amends with an impeccably-struck half volley in the 85th minute to score his first Liga goal of the campaign.
Until then Real had been in danger of dropping points for the fourth time in eight league games and risked falling further behind leaders Barcelona after Jorge Molina had levelled for Getafe in the 56th minute, although Real midfielder Marcos Llorente got the final touch.
Madrid had taken the lead in the 39th minute through an arrowed finish from Karim Benzema, who was starting alongside Ronaldo for the first time since the Champions League final.
Replays showed the equaliser should also have been disallowed for offside against Molina and Real were further aggrieved when substitute Theo Hernandez had a goal ruled out for offside shortly afterwards.
Ronaldo, however, averted another setback in what has been an underwhelming league campaign so far and saved the blushes of coach Zinedine Zidane in the Frenchman's 100th game in charge of Real.
"We started very well and then we relaxed after the break but in the end thanks to our character and the substitutions we fixed it," Zidane told reporters.
"We know that over 90 minutes we can score at any moment and in the second half we struggled but we knew we would be able to get back into the lead and that's what we did."
Real provisionally climbed up to second in the standings, cutting their deficit with Barca to four points, although the leaders can restore their advantage to seven when they visit Atletico Madrid later on Saturday.
With one eye on Tuesday's Champions League game against Tottenham Hotspur, Zidane rested his usual midfield pairing of Casemiro and Luka Modric while also starting without Isco.
Although they led at halftime Real were lacking spark and after the equaliser it took the introduction of substitutes Isco and Theo to whip them back into shape, with the former providing a lofted pass which Ronaldo struck low beyond Vicente Guaita to drag the visitors back into the lead.