Atletico Madrid secured a berth in the Champions League group stage for next season and Deportivo La Coruna narrowly escaped relegation when they came from two goals down to draw 2-2 at champions Barcelona on the final day in La Liga on Saturday.
Atletico made sure of third place thanks to a 0-0 draw at Granada, while Valencia twice had to come from behind to beat Almeria, who were relegated, 3-2 and clinch fourth and a spot in qualifying for Europe's elite club competition.
Real thrashed Getafe 7-3 in Saturday's later kickoff, bringing a disappointing season to an end when they failed to win a major trophy.
La Liga top scorer Cristiano Ronaldo netted a hat-trick, taking his tally to 48 goals, five more than second-ranked Barca forward Lionel Messi.
Sevilla, Europa League holders and finalists again this season, won 3-2 at Malaga to finish fifth, sending them into the continent's second-tier competition again next term along with sixth-placed Villarreal and Athletic Bilbao in seventh.
Bilbao, who are through to next Saturday's King's Cup final to play Barca, ended the campaign with a flourish by thrashing Villarreal 4-0 at the San Mames.
Sevilla face Ukraine's Dnipro Dnipropetrovsk in the Europa League final in Warsaw next week when victory would earn them a place in the Champions League group stage along with Barca, second-placed Real Madrid and Atletico.
Atletico coach Diego Simeone, who led the club to their first La Liga triumph in 18 years last season and the final of the Champions League, said he would give his side a mark of nine out of 10 for their efforts this term.
"In general this has been a typical league campaign," the Argentine told a news conference.
"Madrid and Barcelona fighting for the title, while we battle with Valencia and Sevilla for the remaining places in the Champions League."
Depor's comeback against a second-string Barca, who wrapped up their fifth title in seven years last weekend, sent Eibar back down after one season in the top flight despite the Basque's club's 3-0 win at already relegated Cordoba.
It also put a slight dampener on an emotional final La Liga appearance for Barca captain Xavi, who hoisted the trophy after the match at a festive Nou Camp.
The former Spain international, 35, announced on Thursday he was leaving the club after 17 seasons and 23 trophies to join Qatari side Al Sadd.
Treble-chasing Barca, who are through to the Champions League final to play Juventus on June 6, appeared on course for a comfortable victory when Messi scored his 42nd and 43rd La Liga goals of the season to open a 2-0 lead.
Deportivo, who were relegated in 2011 and 2013, refused to throw in the towel and Lucas Perez and Salomao struck to earn a crucial point for the Galician club.
Their players celebrated wildly after the final whistle before the Barca fans and players paid tribute to Xavi, who joined the club's academy in 1991 at the age of 11 and has made a record 765 appearances for the first team.
Xavi was fighting back tears as he told supporters he was determined to return for a final farewell with the Champions League and King's Cup trophies.
"Thank you for everything," he said. "You have made me the happiest man in the world."