MADRID (Reuters) - 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.
(Reporting by Tommy Lund in Gdansk; Editing by Toby Davis)