MADRID (AP) — With three goals in 20 minutes on Sunday, Real Madrid made sure that Barcelona's stint at the top of the Spanish league didn't last more than a few hours.
Barcelona defeated Atletico Madrid 2-1 with a late winner by Lionel Messi earlier Sunday to move into the lead, but Madrid scored three times in the second half to erase a two-goal deficit and beat Villarreal 3-2.
"In the end we come away with three points against an opponent that can make things difficult for you," Madrid coach Zinedine Zidane said. "We're happy to earn the win against a great side."
Gareth Bale, Cristiano Ronaldo and Alvaro Morata scored for Madrid, which was coming off a loss at Valencia.
Zidane's team equaled Barcelona's record from as far back as 1944 of 44 straight games scoring at least one goal.
Seeking its first league title since 2012, Madrid still has a game in hand at Celta Vigo.
A draw or a loss by Madrid at Villarreal would have allowed Barcelona to stay top.
The hosts went ahead through Manuel Trigueros in the 50th and Cedric Bakambu in the 56th, but Bale pulled Madrid closer with a header in the 64th. Ronaldo equalized by converting a 74th-minute penalty kick prompted by a controversial handball by Villarreal midfielder Bruno Soriano. Substitute Morata netted the winner with a firm header from close range after a well-placed cross by left back Marcelo.
BARCELONA 2, ATLETICO MADRID 1
Messi added to his impressive scoring run this season with an 86th-minute winner at Atletico's Vicente Calderon Stadium,
It was his 35th goal in 35 games, and 11th in the last 10 league games.
His league-leading 20th goal also secured the Argentina star his 400th victory since officially debuting with Barcelona in 2004.
The late goal marked the latest blow dealt by Messi against Atletico — the team he has scored the most goals against in his career. It was his 27th goal against the Madrid club.
Barcelona has won five of the last six league games against Atletico, which hasn't beaten its rival in the last seven games at home dating back to 2010.
"Unfortunately we have not been getting good results against them, but in all these matches we have played well and shown that we could win," Atletico coach Diego Simeone said.
Atletico, which had won four in a row at home and was unbeaten in eight league matches, dropped nine points off the lead.
"We have to stay calm," Simeone said. "The goal doesn't change. We will see where we stand in the final rounds."
Barcelona badly needed a convincing victory to regain confidence following an unimpressive 2-1 win over promoted Leganes — when Messi also scored a late winner — and a demoralizing 4-0 defeat to Paris Saint-Germain.
Rafinha put Barcelona ahead after a scramble in front of Atletico's goal in the 64th and Godin equalized six minutes later with a header off a corner kick before Messi sealed the victory from close range after his initial shot was blocked by a defender in front of the goal.
"We played well enough to win, but they scored in two unfortunate plays for us," Atletico midfielder Gabi Fernandez said. "We know it's always difficult against Barcelona, and today it wasn't any different."
ESPANYOL 3, OSASUNA 0
Espanyol rebounded from two straight losses with a comfortable home win over struggling Osasuna.
Espanyol is ninth, while Osasuna stayed last as its winless streak extended to 16 games. The promoted club's only victory so far was at Eibar in October.
ATHLETIC BILBAO 3, GRANADA 1
Athletic Bilbao picked up its third-straight home win by defeating second-to-last Granada.
Athletic is in eighth place, still in contention for a spot in the Europa League next season.
Granada was trying to win two league games in a row for the first time this season.
SPORTING GIJON 1, CELTA VIGO 1
Celta Vigo striker Iago Aspas scored a 75th-minute equalizer at Sporting Gijon, preventing the hosts from escaping the relegation zone.
The result left Sporting two points behind 17th-placed Deportivo La Coruna, which fired coach Gaizka Garitano on Sunday, a day after a 4-0 loss at newcomer Leganes.
Tales Azzoni on Twitter: http://twitter.com/tazzoni