Racing Santander's 10-year spell in the Primera Division is over after an Antoine Griezmann brace condemned them to defeat to Real Sociedad in San Sebastian.
Sociedad's win confirms their presence in the top flight next season and they had their French playmaker to thank as he scored twice in the second half to settle the match.
The 21-year-old was a constant thorn in Racing's side and added the finishing touch when he teed up Imanol Agirretxe for the third.
Griezmann tested the visiting goalkeeper Mario Fernandez with a header in only the third minute.
It was the first in a series of early chances for the hosts, as Gorka Elustondo, Carlos Vela and Jon Ansotegui all took pot shots at the Racing goal.
The visitors' first opening came in the 19th minute, but Edu could not get his shot on target.
Vela went desperately close to breaking the deadlock in the 22nd minute, but Fernandez made a fine save to turn his driven shot around the post.
Edu then wasted another opening for Racing at the other end.
The breakthrough came two minutes into the second half when Xabi Prieto found Griezmann who finished from close range.
Pedro Munitis then brought the first save out of Claudio Bravo with a left-footed effort in the 57th minute.
Moments later, Griezmann had another chance but the Frenchman could not keep his header down from close range.
Gonzalo Colsa had Racing's best chance in the 65th minute, but Bravo was able to push his driven shot away for a corner.
Griezmann sent a header wide, but had his second moments later as he latched on to David Zurutuza's ball to double the lead in the 70th minute.
Griezmann then turned provider when Agirretxe put the result beyond doubt in the 83rd minute.
Sociedad players were queuing up for chances in the closing stages with Adrian Gonzalez, Agirretxe and Zurutuza going close, but they had already done enough to save their own season and end that of their opponents.