(CNN) -- Cristiano Ronaldo scored a late headed winner as Real Madrid stayed a point behind leaders Barcelona in the Spanish title race after a dramatic 3-2 win over Osasuna on Sunday night.
Real had to come from behind twice in the Bernabeu with former World Player of the Year Ronaldo grabbing a double.
Trailing by four points after Barcelona's 4-1 win over Villarreal on Saturday, Real made a disastrous start as a poor back pass by Raul Albiol allowed in Carlos Aranda to give Osasuna an early lead.
Ronaldo then came to the rescue for the first time as he equalized with a fine strike from just outside the penalty area, but Real were soon behind again as Krisztian Vadocz struck home Osasuna's second.
But with time running out in the first half, Marcelo headed Real level again.
Osasuna refused to lie down and substitute Masoud Soleimani missed the easiest of several chances for the visitors as Real pushed forward for a winner.
The game appeared to be headed for a draw, which would have severely dented Real's title hopes with games running out, until Ronaldo popped up to score an 89th minute goal from a cross by Gonzalo Higuain.
A double from Lionel Messi had helped Barca to rebound from their Champions League exit at the hands of Inter Milan to leave them on course to defend their La Liga crown with a fine win over Villarreal.
In other action on Sunday, Alvaro Negredo scored two penalties to give Sevilla a 3-1 win over Atletico Madrid to lift them into the fourth and the final Champions League place.
The match was a forerunner to the Copa del Rey final later this month.
Atletico, who are also in the Europa League final, fell behind to a Luis Fabiano strike after five minutes.
Tiago Cardoso equalized for Atletico who were then undone by Negredo's two spot kicks.
A double from substitute Nicola Zigic saw Valencia beat Espanyol 2-0 to keep a tight hold on third place.
Getafe were held goalless by Valladolid and Tenerife beat Racing Santander 2-1 but remain in the drop zone as Malaga drew 1-1 with Sporting Gijon.