Cristiano Ronaldo atoned for a glaring miss by scoring his first La Liga goal of the season as Real Madrid defeated cross-city rivals Getafe 2-1.
The reigning Spanish champions had gone ahead in the first half when Karim Benzema also opened his account in the division but Getafe levelled in controversial circumstances through Jorge Molina, who looked offside when he struck nine minutes into the second half.
After that Ronaldo, whose five previous goals this term had come in the Champions League or Spanish Super Cup, somehow prodded wide from close range only to make amends with the winner in the 85th minute.
The Portuguese must have thought he was about to get up and running in the 11th minute only to be denied by Vicente Guaita's terrific stop.
Benzema was just onside when Marcelo's cross from the left was directed his way and the Frenchman controlled the ball on his chest before flicking it across for an onrushing Ronaldo, whose venomous effort was kept out by Guaita's right hand, with the goalkeeper up quickly enough to snaffle the rebound too.
Zinedine Zidane's men were unable to take control of the game and they were not helped by a series of niggling Getafe fouls and the presence of a pitch invader in full Real Madrid attire.
Benzema came close to breaking the deadlock just before the half-hour mark with a flicked effort from Lucas Vazquez's cross that Guaita was alert to before the Frenchman did strike six minutes before the interval.
A poor Getafe free-kick from inside their own half gifted Real possession and then another contribution from the hosts set Benzema away.
Faycal Fajr's sliding intervention to cut out Ronaldo's pass only directed it into Benzema's path and he touched beyond a covering Getafe defender, steadied himself inside the box and picked his spot despite slipping over.
In the second half Marcelo also went for precision with an attempt from just inside the area that a leaping Guaita helped over his crossbar, and it proved important as three minutes later Getafe levelled through Molina.
He was offside and beyond both Marcos Llorente and Nacho when Fajr's cross came in but the assistant's flag remained down as the delivery took a deflection off Sergio Ramos and Molina helped it into the corner.
Real were left in disbelief when Ronaldo fluffed his lines with the goal at his mercy, poking wide from around three yards out after Vitorino Antunes had nodded a free-kick into his path at the back post.
However, five minutes from time, he came up with a winner.
Ronaldo had lost Bruno as substitute Isco clipped a ball over the top, with Antunes having played him onside, and Real's talisman allowed the ball to bounce once before dispatching a clinical finish into the far corner.
Getafe nearly mustered a late equaliser when substitute Mehdi Lacen's attempt flew narrowly wide after goalkeeper Kiko Casilla was caught out of position.