Karim Benzema put the hosts ahead in the sixth minute, slotting home after Alvaro Morata had crossed from the left before Barca equalized 12 minutes later -- Lionel Messi collecting his 18th goal against Real Madrid and his 50th of the season.

Cristiano Ronaldo came on as a sub in the second half and livened up proceedings, but it was Sergio Ramos who scored the winner eight minutes from the end, rising highest to head home Luka Modric's corner.

Just Watched

Marcel Desailly's Ghana regret

Just Watched

Del Piero's Juventus love affair

Barcelona thought they should have been awarded a penalty in the final minute when, at the other end, Ramos appeared to trip Adriano but the referee didn't agree. An angry protest by Victor Valdes after the final whistle earned the goalkeeper a red card.

The result takes Real to 55 points and within one point of second-place city rivals Atletico -- who travel to Malaga on Sunday.

Despite the loss -- just their second in the league this season -- Barca are still way out ahead of on 68 points, but not in an unassailable position just yet, as the match winner Ramos pointed out.

"In the league 13 points is better than 16. We have reduced the distance and whilst it is still possible mathematically we are obliged to fight," Ramos said.

But thoughts are already turning to Tuesday's last 16 Champions League match up against Manchester United at Old Trafford.

Defender Pepe believes back-to-back wins over Barcelona can inspire Real to victory in the second leg with the tie evenly poised at 1-1.