MADRID — Real Madrid ended its Spanish league title-winning campaign with a 2-2 draw that relegated Leganés after four straight seasons in the first division.

The result also ended Madrid's 10-game winning streak following the pandemic break. Zinedine Zidane's team had sealed its record 34th league title — and first in three years — on Thursday.

Madrid ended five points ahead of second-place Barcelona — 87 to 82. Barcelona closed out its campaign with a 5-0 rout of Alavés. Lionel Messi scored twice to finish with 25 goals and become the first player to clinch the league’s scoring title in seven different seasons.

Leganés, led by Mexican coach Javier Aguirre, had entered the match one point behind Celta Vigo, the first team outside the relegation zone. Celta, winless in the final seven rounds, survived despite being held 0-0 by last-place Espanyol. It will play in the top flight for a ninth straight year next season.

Espanyol and second-to-last-place Mallorca had already been relegated.

Sergio Ramos opened the scoring for Madrid with a header in the ninth minute for his sixth goal since the league resumed. Leganés equalized with Bryan Gil's goal in first-half stoppage time before Marco Asensio gave Madrid the lead again from close range in the 52nd.

Roger Assalé equalized again with a shot from inside the area in the 78th but the hosts were not able to get the winner despite some good chances near the end. They wanted a penalty for a hand ball inside the area in the final minutes but video review let the game continue.

Leganés was unbeaten in the last five rounds, with three wins and two draws. The team from southern Madrid last played in the second division in 2015-16.

Madrid played without some regular starters and others were substituted early in the second half.

MESSI DOUBLE

Messi's double helped Barcelona close the league season on a positive note after a 2-1 home loss to Osasuna in the second-to-last-round.

Ansu Fati, Luis Suárez and Nelson Semedo also scored for Barcelona, which had already secured second place in advance.

Messi ended with four more goals than Madrid striker Karim Benzema to clinch his fourth scoring title in a row.

Barcelona now turns its focus to its Aug. 8 home game against Napoli in the round of 16 of the Champions League. The first leg, played before the break, ended 1-1.

“We have important things to play for," Messi said. “We needed some tranquility to clear our heads and come back with more desire than ever.”

EUROPA LEAGUE SPOTS

Villarreal, Real Sociedad and Granada grabbed the Europa League spots in the final round.

Villarreal routed Eibar 4-0 to finish in fifth place, Real Sociedad drew 1-1 at Atlético Madrid to end sixth and Granada defeated Athletic Bilbao 4-0 to earn seventh.

The Champions League spots had already been clinched by Madrid, Barcelona, Atlético Madrid and Sevilla.

Cádiz and Huesca have already secured promotion to the first division.

___

More AP soccer: https://apnews.com/Soccer and https://twitter.com/AP_Sports

___

Tales Azzoni on Twitter: http://twitter.com/tazzoni