Cristiano Ronaldo scored his 40th goal of the season as Real Madrid claimed the LaLiga title for the first time since 2012.
Ronaldo's second-minute strike and Karim Benzema's effort after the break were enough to secure a 2-0 win at Malaga and hand Zinedine Zidane the first domestic trophy of his reign on a night when second-placed Barcelona had to come from behind to see off Eibar.
The game had barely begun when Ronaldo accepted Isco's perfectly-weighted through-ball and rounded keeper Carlos Kameni to open the scoring.
However, it took the visitors until 10 minutes into the second half to extend their lead, Benzema stabbing home from close range after Kameni had saved superbly from Sergio Ramos' volley.
If Zidane was celebrating, Barca counterpart Luis Enrique's final league campaign ended in disappointment despite a 4-2 victory at the Nou Camp.
The mood of the home fans had already darkened as news of Ronaldo's early strike filtered through, but it was to become significantly worse when midfielder Takashi Inui headed home from Ander Capa's seventh-minute cross.
Luis Suarez had an equaliser ruled out for offside seven minutes later, and the hosts were stunned again when Inui smashed home his second with 61 minutes gone.
Defender David Junca's own goal two minutes later lifted spirits and Barca were handed a chance to restore parity from a controversial 70th-minute penalty, only for keeper Yoel to save Lionel Messi's spot-kick.
Suarez did equalise from close range three minutes later and, after Capa had been dismissed for a foul on Neymar, Messi redeemed himself from the spot and then doubled his tally in added time.
Substitute Juanmi was Real Sociedad's hero as he struck deep into added time to secure Europa League football.
Sociedad were trailing 2-1 at Celta Vigo when Juanmi headed home a priceless equaliser in the fourth minute of added time to earn the point they needed to secure a top-six finish.
Midfielder Iago Aspas had put Celta ahead when he converted a 54th-minute penalty after being fouled by Inigo Martinez, but Mikel Oyarzabal levelled with eight minutes remaining.
Andrew Hjulsager looked to have dashed the visitors' hopes when he struck in the final minute of normal time, but Juanmi had other ideas.
They will be joined in the Europa League by Villarreal, who were 3-1 winners at Valencia.
Roberto Soldado got the visitors off to the perfect start when he fired them into a first-minute lead.
Nani headed the home side level nine minutes after the restart to set nerves jangling, but further goals from Manu Trigueros and Nicola Sansone clinched the victory.
It proved to be a disappointing afternoon for Athletic Bilbao, who missed out on a top-six finish after losing 3-1 at third-placed Atletico Madrid.
Fernando Torres did the damage with a double inside the opening 11 minutes and, although substitute Inaki Williams reduced the deficit with 19 minutes remaining, Angel Correa struck within seconds of being introduced as an 88th-minute substitute to seal the win.