Real Sociedad suffered a 2-1 defeat at Atletico Madrid in LaLiga on Sunday, but secured a top-four finish and Champions League qualification after Villarreal also lost 2-1 at Rayo Vallecano.
With one round remaining, Real Sociedad are fourth with 68 points, five ahead of fifth-placed Villarreal.
Real Sociedad will join Atletico Madrid, Real Madrid, and LaLiga champions Barcelona in Europe's elite club competition next season.
Atletico Madrid showed no mercy to Sociedad, with Antoine Griezmann scoring eight minutes before the break and Nahuel Molina doubling their lead after 73 minutes.
Alexander Sorloth pulled one back for Sociedad in the 88th minute, but they could not find a leveller.
Espanyol will join the already-relegated Elche in the second tier after a 2-2 draw against Valencia earlier on Sunday.
The Barcelona-based club needed to win to maintain any chance of avoiding relegation, but their hopes were dashed when Valencia's Samuel Lino equalised three minutes into stoppage time.
"To get to this situation we have done many things wrong, but I think sincerely, from the most self-critical position personally and as a group, that we don't deserve this in this way," Espanyol midfielder Sergi Darder told Movistar.


Rutherford and Motie shine as West Indies sink England
Australia begin T20 World Cup with win over Ireland
Thomas Frank sacked by Tottenham
S Africa survive double Super Over drama against Afghanistan
Farhan fires Pakistan to 32-run win over US in T20 World Cup
