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.