Real Madrid came from a goal down to beat Huesca 2-1 on Saturday and temporarily leapfrog Barcelona into second place.
Raphael Varane scored both goals as a depleted Madrid side -- they only named six substitutes, most of them youngsters -- bounced back from last week's loss to Levante with three points.
Zinedine Zidane's side are now seven points behind leaders Atletico Madrid, although they have played two more games.
Zidane was without a string of regulars for the game, including captain Sergio Ramos who had knee surgery on Saturday.
Also sidelined with injuries were Dani Carvajal, Eden Hazard, Lucas Vazquez, Rodrygo Goes and Fede Valverde, while Eder Militao was suspended.
It meant a six-man bench for Madrid, including two goalkeepers, two players from the B team and Marcelo and Mariano.
Madrid's task was made bigger when they fell behind in the early stages of the second half.
Javi Galan opened the scoring in the 48th minute with a brilliant angled finish from the edge of the box after a quick Huesca counter-attack.
The home side should have been 2-0 soon after when Rafa Mir thumped the bar after another good move.
Varane scored his first not long after, in the 55th minute, and the game opened up.
Marco Asensio almost scored a brilliant solo effort and goalkeeper Alvaro Fernandez made two top saves from Karim Benzema.
Huesca remained a threat on the break and Mir, on loan from Wolves, sent another chance over as the match opened up.
With the game looking increasingly like a draw, Madrid snatched the points at the death when defender Varane scored an unlikely second goal, swiping home a Casemiro knockdown.