Updated

Sergio Ramos' 82nd minute header off Luka Modric's corner kick helped put Real Madrid defeat Barcelona for the second time in five days.

Karim Benzema put Real Madrid ahead in the sixth minute off a cross from Alvaro Morata, but Lionel Messi tied the score in the 18th following a pass from Daniel Alves, reaching 50 goals for the third straight season and extending his record La Liga scoring streak to 16 games. With his 18th goal in the clasico rivalry, Messi tied the record set by Real's Alfredo Di Stefano in the 1950s and '60s.

Ramos scored when he outjumped Gerard Pique for the header at the 6-yard box, helping Madrid to its first home league win over Barcelona since 2008.

During a chippy ending, Ronaldo hit a post with a free kick in the 88th minute, and referee Miguel Angel Perez Lasa didn't call Ramos' trip of Adriano in the penalty area during the third and final minute of stoppage time, prompting vehement arguments from Barcelona players. Goalkeeper Victor Valdes received two yellow cards after the final whistle, resulting in a suspension for next weekend's game Deportivo La Coruna.

Preparing for Tuesday's Champions League match at Manchester United, Real Madrid started Cristiano Ronaldo on the bench and inserted the star forward in the 58th minute. The teams tied 1-1 in Madrid in the first leg of their second-round matchup on Feb. 13.

More On This...

Defending Spanish league champion Real Madrid (17-5-4) pulled within 13 points of first-place Barcelona (22-2-2) and within one point of second-place Atletico Madrid (18-5-2). Real won 3-1 at Barcelona on Tuesday to advance to the Copa del Rey final on 4-2 aggregate.

After a 31-3-5 start in all competitions, Barcelona has lost three of its last four games, including a 2-0 defeat at AC Milan in the first leg of its Champions League round of 16 matchup. Barcelona host the second leg of the total-goals series on March 12.

Barcelona's slide has coincided with the absence of first-year coach Tito Vilanova, who has been in New York for medical treatment since late January following an operation in Spain to remove a tumor from his saliva gland.

Based on reporting by the Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino