(CNN) -- Barcelona were crowned Spanish champions for the first time since 2006 after Real Madrid were beaten 3-2 at Villarreal on Saturday night.
Barcelona fans celebrate on the famous Ramblas boulevard after Real Madrid's 3-2 defeat at Villarreal.
Madrid twice came from behind to draw level, but goalkeeper Iker Casillas' error in stoppage time gifted Villarreal the victory which leaves Juande Ramos' side eight points behind Barca with just two games left.
Barcelona travel to Real Mallorca on Sunday evening, but the Catalans' focus can now turn to their Champions League final meeting with Manchester United.
It is Barcelona's second trophy this season after they secured the Copa del Rey in midweek.
Villarreal denied Pep Guardiola's men the title last weekend as they scored a last-gasp leveller at the Nou Camp, and there was another thrilling climax at El Madrigal, although this time Barca were the beneficiaries of the late goal.
The normally unflappable Casillas dropped a cross at the feet of Joan Capdevila who tapped home the winner at the death.
Gonzalo Higuain had looked to have secured a point for Madrid with an 88th-minute leveller which looked clearly offside.
Earlier Robert Pires (17) and Ruben Cani (62) twice put the Yellow Submarines ahead either side of a Rafael Van der Vaart equalizer.
The win moved Villarreal level on points with Valencia in the race for fourth place and the final Champions League qualification spot. The two sides meet next weekend.
Elsewhere on Saturday, third-placed Sevilla were held to a goalless draw by Osasuna, who moved three points above the drop zone.
Both teams ended the game with 10 men after Sevilla had Ndri Romaric dismissed in the 83rd minute and Osasuna's Sergio Fernandez was sent off in added time.
Riki's late strike earned Deportivo La Coruna a 1-1 draw with Getafe to leave the Madrid-based side sweating over their Primera Liga survival.
Roberto Soldado's goal just after half-time looked to have given Getafe a second straight league win, and that would have seen Michel's side reach the 40-point mark ahead of key games against Numancia and Racing Santander.
But former Getafe striker Riki struck five minutes from time to frustrate his old team-mates and keep Deportivo's hopes of a place in European competition next season alive.