MADRID (AP) -- Cristiano Ronaldo scored a late equalizer as Real Madrid avoided a bruising derby defeat at Spanish title rival Atletico Madrid with a 2-2 draw on Sunday.
Ronaldo pounced on a loose ball inside the area to net the 82nd-minute equalizer -- his 23rd goal of the season for the league leaders.
Karim Benzema put Madrid ahead at the Vicente Calderon Stadium after three minutes but, instead of wilting, Atletico hit back with two goals to take the lead by halftime.
Koke smashed a low shot beyond Madrid goalkeeper Diego Lopez, who then watched Gabi Fernandez's swerving effort from 30 meters (yards) fly past him just before the break.
Madrid stayed three points ahead of Atletico, but Barcelona was able to cut its deficit to Madrid to one point after a labored 4-1 win against Almeria at the Camp Nou.
Barcelona led 2-0 by the 24th after Alexis Sanchez tapped a rebound into the empty goal before Lionel Messi curled an exquisite left-foot free kick around the defensive wall and into the top of the goal for his 15th league strike of the season.
A rout looked in the cards until Angel Trujillo got free to head home a corner in the 27th, and the relegation-threatened club made Barcelona work for its points.
Carles Puyol, who had made a rare start, scored an even rarer goal after Messi's header came off the bar straight to him in the 83rd minute.
Xavi Hernandez scored moments later as the Catalans bounced back from a 3-1 loss to Real Sociedad last weekend.
Madrid leads with 64 points, Barcelona has 63, and Atletico is on 61 points.
The fifth meeting between crosstown rivals Atletico and Madrid since last May's Copa del Rey final kept its trademark liveliness and aggression, with Atletico knowing defeat would likely end its dreams of a first title since 1996.
"Atletico tried to make the game violent," Madrid coach Carlo Ancelotti said. "We don't play that way, however. But they tried right to the end."
Atletico's defense played Benzema onside for the France striker to score his 15th of the season, leaving him alone to guide Angel Di Maria's cross into the box past goalkeeper Thibaut Courtois.
Ugly confrontations followed as both teams used gamesmanship to try and gain an edge, with Arda Turan booked for protesting in the 11th after Sergio Ramos tripped Diego Costa inside the area with no penalty awarded.
But Atletico's pressure paid off in the 28th when Turan spotted Koke inside the area to smash past Lopez.
Diego Costa, who will play at the Calderon for Spain on Wednesday, was a physical presence and troubled Madrid throughout. Atletico took the lead in first-half stoppage time when Gabi's powerful drive beat the slow-footed Lopez for a deserved lead.
In the second half, Lopez kept it close as Atletico found space on the counter with Madrid pressing for an equalizer.
Despite being outplayed, Madrid's attack finally connected when Gareth Bale failed to control a cross but the ball fell to Ronaldo to extend Madrid's unbeaten run in all competitions to 28 games.
"Atletico played a bruising style right to the end, when we finally got a chance to play and create opportunities," Ancelotti said.
Madrid is unbeaten at the Calderon for 15 games, dating to June 1999.
"The result is what it is," Atletico coach Diego Simeone said. "We had chances to win it. At least we showed we are still alive in the title race."
Ruben Castro's late goal gave bottom side Real Betis a 1-1 draw at 10-man Villarreal, which slipped six points from fourth and the final Champions League spot. Betis was left 11 points from safety.
Real Sociedad fell seven points behind fourth-place Athletic Bilbao after Kevin Gameiro skipped through a pair of defenders and netted the rebound from his initial shot to lead Sevilla to a 1-0 victory.
Joaquin Larrivey scored as Rayo Vallecano climbed within three points of 17th-place Almeria -- and safety from the drop -- with a 1-0 win over Valencia, which played the last 15 minutes with 10 men.
Follow Paul Logothetis on Twitter: www.twitter.com/PaulLogoAP