Sporting Gijon clinched survival in La Liga with a 2-0 victory over Villarreal with Getafe and Rayo Vallecano suffering relegation.
Sporting's win over fourth-placed Villarreal was a surprise result.
Rayo secured a 3-1 win over Levante that became irrelevant with the Sporting result. Rayo finished one point behind Sporting in 18th.
The defiant Rayo fans raised a banner which read "Never fear a sudden sinking. From a sunken boat comes a submarine."