Real Madrid beat Barcelona 2-1 in the Spanish league on Saturday for its second victory over its fierce rivals in five days before its critical Champions League trip to Manchester United.
Barcelona's Lionel Messi extended his Spanish league scoring record to 16 straight games in the 18th minute to cancel out Karim Benzema's sixth-minute opener, while Cristiano Ronaldo rested on the bench until the final half hour.
An ugly second half seemed destined to end in a draw until Sergio Ramos rose up to head in Luka Modric's corner in the 82nd to give Madrid its first home win in league play over Barcelona since 2008.
Madrid still trails leader Barcelona by 13 points.
Madrid visits United on Tuesday with their last-16 tie poised at 1-1.