Cristiano Ronaldo's first La Liga goal for over a month ensured Real Madrid closed the gap on La Liga leaders Barcelona to seven points by squeezing past struggling Malaga 3-2 on Saturday.
Ronaldo's relief was clear to see when he fired home the rebound after seeing his penalty saved by Roberto 15 minutes from time.
First-half goals from Karim Benzema and Casemiro had twice put the European champions in front.
However, their defensive fragilities without injured captain Sergio Ramos were also exposed as Diego Rolan and Chory Castro twice levelled for Malaga, who remain in the relegation zone.
Ronaldo's winner does though put some pressure on Barca when they travel to Valencia for a top-of-the-table clash on Sunday.
The Catalans will though be buoyed by Lionel Messi ending speculation over his future by finally signing a contract extension to 2021 earlier on Saturday.
Ronaldo also played his part for Benzema's opener after just nine minutes.
The World Player of the Year rose highest at the back post and when his header came back off the angle of post and bar, the unmarked Benzema had the simple task of nodding into an empty net.
Real looked set to shake off their league struggles so far this season in a dominant start as Dani Carvajal also forced Roberto in the Malaga goal into the first of a series of impressive stops.
However, a slack pass from Toni Kroos on the edge of his own box handed Malaga a route back into the game on 18 minutes.
Keko pounced on the German World Cup winner's gift and his cross was calmly chested down and slotted beyond Kiko Casilla by Rolan.
Parity only lasted three minutes for the visitors, though, as Kroos made amends with a corner from which Casemiro powered home.
Benzema and Ronaldo had plenty of chances to improve their meagre goalscoring returns this season with the Frenchman first to pull a great chance beyond the far post.
Roberto then denied Ronaldo from close range before producing an even more stunning stop by leaping to his left to claw away a powerful header from the Portuguese.
Madrid's fans had complained before kick-off at their perceived harsh treatment from referees this season, but it was the hosts who were handed a let off from the officials on the stroke of half-time.
Paul Baysse's header looked to have levelled with the last touch of the half, but the French defender was penalised for a push on Dani Carvajal.
Malaga did level just before the hour mark thanks to some calamitous goalkeeping from Casilla as he let Castro's drive from 25 yards slip through his grasp into the bottom corner.
Ronaldo saw another chance slip away as he failed to make any connection on Raphael Varane's knockdown moments later.
However, his moment came when substitute Luka Modric was tripped inside the area and referee Jesus Gil Manzano awarded Real their first penalty in La Liga this season.
Ronaldo still couldn't find a way past Roberto with his first effort, but followed up to smash home the rebound to avoid Real's title chances suffering another severe blow.