Cristiano Ronaldo’s first La Liga goal for over a month ensured Real Madrid closed the gap on 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.
Atletico Madrid remain tied with Real in third after they shrugged off a season of goal-scoring woes by thrashing Levante 5-0 thanks to doubles from Antoine Griezmann and Kevin Gameiro.
Both Madrid sides will now be hoping Barca slip up when they travel to Valencia for a top-of-the-table clash on Sunday (1945GMT).
However, the Catalans will be buoyed by Lionel Messi ending speculation over his future by finally signing a contract extension to 2021 earlier on Saturday.
“We are pleased with the result because the team showed character with time running out to score the third,” said Madrid boss Zinedine Zidane.
“There were plenty of good things, but also things we didn’t want to see.”
Real looked set to shake off their recent league struggles in a dominant start as Ronaldo’s header came back off the woodwork leaving the unmarked Karim Benzema with the simple task of nodding into an empty net.
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 Diego Rolan.
“We can play better for sure, it is true we gave the ball away too much,” added Zidane.
“We are going to be positive because today we’ve taken the three points, but we can do things much better.
Real bailed out
Parity only lasted three minutes for the visitors though, as Kroos made amends with a corner from which Casemiro powered home.
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 Chory Castro’s drive from 25 yards slip through his grasp into the bottom corner.
However, Real were bailed out when they were finally awarded their first penalty in La Liga this season when Luka Modric was tripped inside the area.
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.
Atletico had scored just four goals in their previous six La Liga games, but ran riot at the Ciutat de Valencia for their first victory at Levante in six visits.
The hosts played a huge part in their own downfall as Rober Pier turned Gameiro’s cross into his own net after just five minutes and Chema Rodriguez’s botched goal line clearance then handed the Frenchman an open goal to double Atletico’s lead before half-time.
Gameiro’s future at Atletico remains uncertain with Diego Costa’s impending return, but his link-up play with compatriot Griezmann saw the visitors net three more in a nine-minute spell after the break.
“You can see that Antoine and I have a good relationship on and off the field,” Gameiro told BeIN Sports Spain.
“When you don’t win people talk a lot, but we are very serious and work hard every day to win games.
“Now we are in good form and we need to keep going.”
Griezmann’s lovely through ball was slotted home by Gameiro before he returned the favour for Griezmann to finish on the stretch.
And when Oier Olazabal could only parry Gameiro’s next effort, Griezmann swept home the rebound for his third goal in two games after an eight-match goal drought.