Real Madrid won the Spanish league for the first time in five years on Sunday, avoiding its worst title drought since the 1980s and keeping Barcelona from its third straight championship.

Zinedine Zidane’s team secured its 33rd league title with a 2-0 win at Malaga with goals by Cristiano Ronaldo and Karim Benzema.

The last-round victory gave Madrid a three-point advantage over second-placed Barcelona, which rallied from two goals down to beat Eibar 4-2 at the Camp Nou.

Madrid entered the final weekend needing a draw to guarantee its first title since 2012.

Ronaldo put Madrid in control early in Malaga, entering the area and rounding the goalkeeper before finding the open net following a pass by Francisco ”Isco” Alarcon two minutes into the match at the Rosaleda Stadium. It was his 14th goal in his last nine matches in all competitions.

Karim Benzema sealed the victory in the 55th minute off the rebound of a close-range shot by Sergio Ramos, securing Madrid its second league title in the last nine years.

Madrid hadn’t gone five straight seasons without a league title since 1981-85. It will pursue its third Champions League title in four seasons in a final against Juventus in Cardiff on June 3.

It was the first league title for Zidane, the former France great who took over Madrid for his first head-coaching job less than 1 + years ago.

”It is very important to lift this trophy again after so many years without being able to win La Liga,” said Zidane, who was thrown up and down by his players after the final whistle.

Players wore shirts with the No. 33 – in a reference to the 33rd title – as they celebrated on the pitch before heading back to Madrid to meet their fans in a major public plaza.

Madrid celebrates their La Liga title win
Madrid celebrates their La Liga title win
Madrid has already won the European Super Cup and the Club World Cup this season.

At the Camp Nou, Barcelona saw its chances of another league title take a hit after Japanese midfielder Takashi Inui scored in the seventh and 61st minutes.

Barcelona started its comeback with an own-goal by Eibar defender David Junca in the 63rd, and Luis Suarez equalized in the 73rd after Lionel Messi had missed a penalty kick a few minutes earlier.

Messi, the league’s scoring leader with 37 goals, converted another penalty in the 75th and closed the scoring in injury time.

Eibar played a man down from the 74th as defender Ander Capa was sent off.

It was Barcelona’s last game at the Camp Nou with coach Luis Enrique, who is leaving the club after the season ends.

Barcelona will play the Copa del Rey final against Alaves next Saturday.

Tales Azzoni, AP