Real Madrid's departing great Karim Benzema struck from the penalty spot to earn his side a 1-1 draw against Athletic Bilbao on Sunday in La Liga as he said goodbye to fans at the Santiago Bernabeu.
Elsewhere Real Valladolid were relegated after a 0-0 draw with Getafe, while five other sides near the bottom were able to breathe a sigh of relief after a gripping conclusion to the season.
Champions Barcelona were beaten 2-1 at Celta Vigo, with Gabri Veiga's brace ensuring the Galician side will remain in the top flight next season.
Benzema, whom Madrid confirmed would leave this summer earlier in the day, departing after 14 years at the club, rolled his penalty down the middle to level the game, before being substituted to great applause.
The draw ensured Real Madrid would finish above city rivals Atletico Madrid in second place, after Diego Simeone's side tied 2-2 at Villarreal on the final day.
"I spoke with him this morning and he told me he was going. He's taken the decision and I told him I respect it completely," said Real Madrid coach Carlo Ancelotti.
Ancelotti said Benzema's choice came by surprise, after the Italian himself said Saturday he expected the forward to stay.
"I have coached one of the best in the world, not a forward, a complete footballer," continued the coach.
"A very friendly, humble, serious person. We can't be happy he is going, but we have to respect his decision. What he has done at this club is legendary and unforgettable."
Athletic were the stronger team and only a stunning Thibaut Courtois penalty save to deny Mikel Vesga kept his team level at the break.
Oihan Sancet struck early in the second half to give the visitors the lead but Benzema netted from the spot after a soft penalty was given for a foul on Eder Militao.
It was the 35-year-old's 354th goal of a sparkling career in the Spanish capital after his 2009 move from Lyon.
Benzema, who has won five Champions League titles and La Liga on four occasions, seems to be set to play in Saudi Arabia, where former team-mate Cristiano Ronaldo has moved.
Vinicius Junior made his first appearance for Real Madrid since he was racially abused by Valencia fans, causing worldwide anger and support for him.
Madrid's season was a disappointing one -- they won the Copa del Rey but were beaten heavily by Manchester City in the Champions League semi-finals and finish 10 points behind their most bitter rivals, champions Barcelona.
Xavi Hernandez's side were beaten at Balaidos, with Veiga slotting home in the first half and then adding a second from an attempted cross which flew in.
Ansu Fati pulled a goal back for the champions but they could not find a leveller.
Valladolid could not find a way through against Getafe and were relegated.
"There's little explanation, the team tried, we tried to make it hard for Getafe but we didn't do it," said Valladolid goalkeeper Jordi Masip.
"It's a huge shame for all the team, all the fans, all the city, I can't say much more. We needed to score, there was no other way."
Their final hope would have been a late Espanyol winner against Almeria, but the Andalusians held on for a 3-3 draw to survive by a point in 17th place.
Valencia were another team who started the day in danger but they earned a 1-1 draw at Real Betis, who said their own goodbye to captain Joaquin Sanchez.
The 41-year-old is retiring and made his 622nd appearance in the top flight, equalling the all-time record first set by goalkeeper Andoni Zubizarreta.
"It's a special day, a beautiful day, when I'm with my people, my family, the club that gave me everyone," an emotional Joaquin told Movistar, kissing the Benito Villamarin pitch when he was substituted.
"I am who I am thanks to Real Betis."
Osasuna beat Girona 2-1 to climb above Athletic and snatch seventh place -- qualification to next season's UEFA Europa Conference League.
Ante Budimir hit a brace for the Copa del Rey runners-up, who were able to celebrate their fine season with supporters at El Sadar.