Barcelona made sure of Champions League football again next season after Jordi Alba struck a fine volley deep into stoppage time to secure a 2-1 win at Real Betis.
Substitute Ansu Fati gave Barca the lead with 14 minutes to go against the Copa del Rey winners, who had been given a guard of honour before kick-off.
However, defender Marc Bartra swiftly hauled Betis level against his former club, only for Alba to secure a dramatic victory when he volleyed in a cross from Dani Alves.
Barcelona moved 11 points clear of fifth-placed Betis heading into the final three games of the season.
Earlier, Granada had boosted their survival hopes with a 6-2 win at relegation rivals Mallorca, where Jorge Molina scored twice.
Athletic Bilbao saw their push for European qualification dented after being held to a goalless draw at home by Valencia, who had substitute Hugo Guillamon sent off in stoppage time.
Cadiz moved three points clear of the relegation zone after a late goal flurry during the closing 10 minutes secured a 3-0 win over Elche, who saw substitute Ezequiel Ponce receive a straight red card shortly after coming on during the second half.
Celta Vigo pushed bottom club Alaves a step closer to the drop with a 4-0 win.
Veteran forward Iago Aspas scored twice for the hosts, while Alaves defender Ximo Navarro was sent off just after the hour.
Julian Brandt scored twice as Borussia Dortmund won 3-1 at relegated Greuther Furth to make sure of runners-up spot in the Bundesliga.
Successive defeats to champions Bayern Munich and then mid-table Bochum had given Bayer Leverkusen an opening heading into the final two games.
Brandt set Dortmund on their way with a close-range finish midway through the first half.
Although Jessic Ngankam equalised with 20 minutes left, midfielder Brandt soon stuck again before substitute Felix Passlack secured victory.
Leverkusen confirmed their own Champions League place next season after coming from behind to win 4-2 at Hoffenheim, where Patrik Schick scored twice.
Freiburg, though, saw their top-four hopes dented after losing 4-1 at home to Union Berlin and Wolfsburg were 1-0 winners at Cologne.
Hertha Berlin are still not certain of avoiding a relegation play-off after losing 2-1 at home to Mainz but will be if Stuttgart suffer an expected defeated at Bayern on Sunday.
In Serie A, a late goal from Fabian Ruiz gave Napoli a 1-0 win at Torino to tighten their grip on third place.
The Partenopei are now four points ahead of Juventus with just two games left.
Lazio kept themselves on course for European League qualification with a 2-0 win over Sampdoria and it finished 1-1 between Sassuolo and Udinese.
Nantes secured a first major trophy since 2001 after a penalty from Ludovic Blas early in the second half proved enough to beat Nice 1-0 in the Coupe de France final.
In Ligue 1, Kevin Gameiro’s late goal secured Strasbourg a 1-0 win at Brest to keep up hopes of a place in the Europa Conference League.