Atletico Madrid were crowned champions for the first time since the 2013/14 season after a come-from-behind 2-1 win over Real Valladolid, who were relegated in the final match at Estadio Jose Zorrilla.
Valladolid had a perfect start after Oscar Plano gave them the lead in the 18th minute with low strike past goalkeeper Jan Oblak from a one-on-one situation.
Atletico went to the break trailing 1-0 and Angel Correa brought them back into the game just before the hour-mark with a cracking strike from the edge of the box.
Luis Suarez snatched the winner for Diego Simeone's charges in the 67th minute with a clever finish at the near post after going clear on goal, one-on-one with goalkeeper Jordi Masip.
Real Madrid narrowly lost out on the title despite coming from behind to beat Villarreal 2-1 in the final match at Alfredo di Stefano.
Zinedine Zidane's charges had a horrible start after Yeremi Pino gave Villarreal the lead in the 20th minute.
After going to the break a goal behind, Karim Benzema thought he had found the equaliser for Madrid with a headed goal just before the hour-mark but the goal was chalked off by the Video Assistant Referee (VAR) for a marginal offside.
Benzema finally levelled matters for the visitors in the last three minutes with a strike into the top corner and Luka Modric snatched the winner with a stunning half-volley into the top corner but it was not enough, as leaders Atletico Madrid won their match and won the title by two points.
Villarreal missed out on a place in the UEFA Europa League after finishing in seventh spot but they could earn a place in the UEFA Champions League if they win this season's Europa League final against Manchester United next Wednesday.
FC Barcelona secured third spot and a place in the UEFA Champions League after edging relegated Eibar 1-0 in the final match at Estadio Municipal de Ipurua.
Blaugrana were out of the race for the title, with Lionel Messi given a rest.
The game could not produce fireworks in the first stanza and Antoine Griezmann finally broke the deadlock for Barca in the last nine minutes with a volley at the back post.
Takashi Inui nearly levelled matters for Eibar in the last two minutes with a deflected strike that looped over goalkeeper Neto and came off the crossbar and Ronald Koeman's troops held on to finish in third place while Eibar finished in bottom place on the log.