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.