LaLiga champions Real Madrid signed off with a 2-2 draw at Leganes, which saw the hosts relegated.
Leganes had to win to stand a chance of overhauling Celta Vigo, whose draw at Espanyol proved enough to keep them up by a point.
Los Blancos – who had secured the league title on Thursday – took the lead through a header from captain Sergio Ramos.
Bryan Gil equalised just before half-time, but Marco Asensio put Real back in front early in the second half before Roger Assale’s 78th-minute goal set up a tense finale, but there was to be no late drama.
Zinedine Zidane’s men will be back in Champions League action next month against Manchester City, trailing 2-1 from the first leg of their last-16 tie.
Lionel Messi secured the golden boot once again with a brace as Barcelona finished the LaLiga season with a 5-0 win at Alaves.
The Argentina forward took his tally to 25 with a goal in each half after teenage forward Ansu Fati had opened the scoring in the 24th minute.
Luis Suarez made it 3-0 just before half-time, with defender Nelson Semedo – one of just five substitutes named on the bench – adding a fourth just before the hour and Messi completing a comfortable victory with 15 minutes left.
Barcelona will next be in action when they play Napoli in the second leg of their Champions League last-16 tie on August 8, which is level at 1-1.
Elsewhere, Gerard Moreno scored twice during the closing stages as fifth-placed Villarreal beat Eibar 4-0.
Santi Cazorla was given a standing ovation as he went off late in what was the former Arsenal winger’s final LaLiga appearance for the Yellow Submarine, while captain Bruno Soriano entered his retirement with a win.
Atletico Madrid finished third after a 1-1 home draw against Real Sociedad, with Adnan Januzaj’s late goal securing a point for the visitors who finished sixth.
Granada – on their return to the top flight this season – secured seventh place and the chance of Europa League qualification after a 4-0 win over Athletic Bilbao as Getafe missed out following a 2-2 draw at Levante – where defender Coke scored a late equaliser.
Sevilla beat Valenica 1-0, as Los Che saw their European hopes ended. Real Valladolid had earlier defeated Real Betis 2-0 while Osasuna drew 2-2 against relegated Mallorca.
In Serie A, a late penalty from Romelu Lukaku saw Inter Milan secure a 2-2 draw at Roma to close the gap on leaders Juventus to five points.
Defender Stefan De Vrij gave the visitors the lead after 15 minutes, but Leonardo Spinazzola equalised just before half-time.
Henrikh Mkhitaryan put the hosts in front after 57 minutes, but Belgian forward Lukaku had the final say when he converted a penalty two minutes from time.
Juve can extend their advantage again when they host Lazio on Monday evening.
Matteo Politano’s spectacular last-gasp goal helped Napoli beat Udinese 2-1 to keep them in the hunt for Europa League qualification.
Rodrigo De Paul put the visitors ahead in the 22nd minute but substitute Arkadiusz Milik soon equalised with what was his first touch after coming on.
Deep into stoppage time, Politano secured all three points when he lashed the ball in off the post.
Sunday’s earlier kick-off saw Claudio Ranieri’s Sampdoria recover from 2-0 down to win 3-2 at Parma.
The hosts seemed in control after Gervinho and an own goal from defender Bartosz Bereszynski had given them a 2-0 half-time lead.
However, Julian Chabot started the fightback three minutes after the restart when he headed in from a corner. Fabio Quagliarella’s deflected effort drew the Blucerchiati level – and then substitute Federico Bonazzoli completed the turnaround with 12 minutes left.
Elsewhere, a stoppage-time strike from Jaromir Zmrhal – whose two goals were his first in Serie A – helped strugglers Brescia come from behind to beat bottom club SPAL 2-1, which mathematically confirmed their relegation, while Fiorentina beat Torino 2-0.
A late own goal from goalkeeper Gabriel – the ball going in off his back after hitting the far post – saw Genoa boost their own survival hopes with a 2-1 win over fellow relegation-battlers Lecce.