Real Madrid had to come from behind to beat last-placed Huesca 2-1 away and move to within seven points of resting La Liga leaders Atletico Madrid on Saturday.
Huesca took the lead three minutes into the second half when Javi Galan scored from outside the area after good work from Pablo Maffeo down the right.
Raphael Varane levelled with a header on 55 minutes from close range after Karim Benzema’s header came back off the bar.
And the French defender got the winner on 84 minutes when he turned in a Casemiro header from a Toni Kroos free-kick.
It was a timely reminder of the importance of Varane on the day when Sergio Ramos had an operation on his left knee with an estimated recovery time of eight weeks.
It was also timely for Real coach Zinedine Zidane who had called for more respect for his players in the build-up to the game and saw them show plenty of spirit to come back and win the match.
After a flat first half Huesca twice hit the frame of the goal after the restart with Rafa Mir and Mikel Rico both denied either side of their opening goal.
Madrid also needed Thibaut Courtois to save brilliantly from a Mir header as Huesca scrambled desperately for at least a point from the match.
As well as captain Ramos, Madrid were missing Eden Hazard, Fede Valverde, Dani Carvajal, Lucas Vazquez, Isco and Rodrygo Goes. They had just four outfield players on the bench.
“When things get tough you see the characters come through. We know there is still lots to play for,” said Varane.
Also on Saturday, Levante drew 2-2 with Granada and Villarreal 2-2 with Elche.
In the later match, Sevilla went third when they beat Getafe 3-0 but the win was marred by a serious injury to winger Lucas Ocampos.
A challenge from Getafe defender Djene on the Sevilla player’s ankle saw him stretchered off. Djene was sent off.
Both coaches Jose Bordalas and Julen Lopetegui were sent off as they exchanged angry words on the touchline after the incident.
With the man advantage, Sevilla scored three times through Munir El Haddadi, Papu Gomez and Youssef En-Nesyri to win the match.
It was Gomez’ first goal for his new club and En-Nesyri’s 13th of the season but with Ocampos taken to hospital for checks on his ankle the mood was sombre.
Lopetegui said: “I need to publicly apologise for losing my head on the touchline. That is not how a Sevilla coach should behave.”
Sevilla midfielder Oliver Torres added: “I saw the ankle double over. It was an accident without intent. We hope he recovers soon.”