Barcelona finish with defeat by Villarreal
Barcelona finished 13 points behind La Liga champions Real Madrid after ending their turbulent season with a whimper on Sunday by losing 2-0 at home to Villarreal.
Atletico Madrid secured third place by winning 2-1 away at Real Sociedad, retaining their one-point lead over Sevilla, who won 1-0 at home to Athletic Bilbao.
Athletic's defeat, combined with Villarreal's excellent victory at Camp Nou, means Villarreal beat Athletic into seventh and qualify for the Europa Conference League.
Villarreal's season was lit up by their sensational run to the semi-finals of the Champions League but Unai Emery's team have suffered from inconsistency against the lower sides in La Liga and will be demoted to Europe's third-tier competition next term.
Athletic finish eighth while Real Sociedad held onto sixth and Europa League qualification, despite their loss at home to Atletico Madrid.
At the other end of the table, Granada joined Alaves and Levante in being relegated.
Granada were held to a goalless draw by Espanyol, allowing Cadiz, who won 1-0 away at Alaves, to survive. Mallorca also stayed up by beating Osasuna 2-0.
Barca already had second place and a spot in the top four wrapped up but Xavi Hernandez will be concerned heading into the summer about how his team has faded.
"We feel a bit sad about today's result," Dani Alves told Barca TV. "We have to reflect, change our mentality next season and put more effort on the pitch because we are representing this great club and we cannot reach the end of the season again without competing for anything."
Defeat by Villarreal means Barcelona lost four of their last nine games in all competitions while Real Madrid won La Liga at a canter.
After being appointed in November, with the team lying ninth, Xavi revived the team and achieved the most important objective of qualifying for the Champions League.
But going out to Frankfurt in the Europa League semi-finals and Athletic Bilbao in the Copa del Rey was disappointing while the drop-off during the run-in suggests there is still a lot of work to do.
Villarreal's two goals came either side of half-time as Alfonso Pedraza scored in the 41st minute after latching onto a Dani Parejo through-ball before Moi Gomez made it two in the 55th.
Adama Traore was at fault, his attempted clearance across his own box falling straight to Gomez, who fired in, with Traore substituted immediately after.
Atletico's victory over Real Sociedad came after Rodrigo de Paul and Angel Correa scored goals in the second half before Jon Guridi grabbed a consolation for the hosts late on.
Rafa Mir's smart finish inside the post in the 68th minute proved enough for Sevilla to overcome Athletic Bilbao at the Ramon Sanchez Pizjuan.
Cadiz began the day a point behind both Granada and Mallorca as the three clubs scrapped to avoid the final relegation spot, with Alaves and Levante already down.
Anthony Lozano proved the hero, his finish securing victory away at Alaves for Cadiz, while Granada were held to a stalemate at home to Espanyol.
Jorge Molina had the best chance to win it for Granada but sent his penalty agonisingly wide of the post in the 72nd minute, before Cadiz took the lead at Mendizorrotza in the 76th.
By then, Mallorca were already one up away at Osasuna after Angel Rodriguez had put them in front. Clement Grenier added another as Mallorca won 2-0 away at El Sadar to avoid the drop.