Champions Real Madrid drew their final La Liga game which relegated opponents Leganes to the second division.
Celta Vigo’s goalless draw at Espanyol was enough to keep them up by a single point at the expense of Leganes.
Captain Sergio Ramos netted his 12th goal of the season by heading in from Isco’s cross for Real, who had wrapped up the title in their previous game.
Bryan Gil and Roger Assale netted either side of Marco Asensio’s strike but it was not enough for the visitors.
Leganes needed to find a late goal to leap out of the bottom three and Oscar broke forward in the 96th minute, but lashed his effort over from the edge of the area.
Zinedine Zidane’s side will look to overturn a 2-1 first-leg loss against Manchester City in the Champions League last 16 when they return to action in August.