It took a record-setting Real madrid to finally dislodge Barcelona from its perch atop the Spanish league with a competition-high 32nd title and its first in four long seasons dominated by its biggest rival.
Madrid won 3-0 at Athletic Bilbao on Wednesday for its first league championship since 2008, forcing Barcelona to relinquish the title after three straight years despite winning 4-1 against Malaga in a game in which Lionel Messi broke a 39-year-old European club scoring record by hitting a hat trick to take his season total to 68 goals.
Madrid, which can set a record total of 100 points with victories in its last two games, has already broken a 22-year mark for most goals scored in a season, while Jose Mourinho became the first coach to win titles in four different European leagues.
"It was difficult to beat a team like Barcelona, but we managed it," captain Iker Casillas said. "We had to overcome our rival's greatest period, and those who have been here longer have seen it all. In the end, you have to be the best of the best to win the league."
Madrid's players celebrated wildly after the final whistle at San Mames stadium, with Mourinho displaying seven fingers to symbolize the number of league titles he has won in his career, including at FC Porto, Chelsea and Inter Milan.
"This was the most difficult one," said Mourinho, who team has a seven-point lead over Barcelona with two rounds left.
Madrid's squad will officially celebrate in the Spanish capital on Thursday after finally getting the better of a Barcelona team that has dominated Spanish and European football since coach Pep Guardiola's arrival in 2008.
"The players are all very happy after 10 months of fighting, of training, of games, the objective was to be champion so we are happy to have achieved it," Cristiano Ronaldo said. "To have beaten a team like Barca makes this league win more difficult. It's much better to win against one of the best teams - it makes it better."
Gonzalo Higuain's 16th-minute goal proved the winner, with the Argentina striker clinching Madrid's latest title four years after his goal secured its last.
Mesut Oezil doubled the lead four minutes later before Ronaldo added his 58th goal of the season in the 50th - and the club's record 115th this campaign - to make up for a penalty in the 12th that was saved by goalkeeper Gorka Iraizoz. Ronaldo also missed a penalty in the Champions League semifinal shootout loss to Bayern Munich last week.
"I have two Golden Boots at home. So if I win the third, great. If not, not a problem," said Ronaldo of the race to finish as Europe's leading scorer.
Messi broke the record of 67 goals Gerd Mueller set for Bayern Munich in 1972-73. He converted penalties in the 35th and 59th minutes and chipped goalkeeper Carlos Kameni in the 64th for his seventh league hat trick, tying the mark set by Ronaldo this season.
The 24-year-old Messi has played 57 games for Barcelona this season, and broke records by scoring 46 goals in the league and 14 in the Champions League.
But while Barcelona celebrated Messi's scoring feats, Madrid's famous Plaza de Cibeles began filling with fans in anticipation of Madrid celebrating the end of its great rival's league dominance and yet another title for Mourinho.
At the Camp Nou, Carles Puyol's 13th-minute opener for Barcelona was canceled out by Jose Rondon for Malaga.
Iniesta was fouled inside the area to set up Messi's 34th-minute spot kick that matched the 66-goal tallies by Pele for Brazilian club Santos in 1958 and Ferenc Deak for Hungarian team Ferencvaros in 1948-49.
Malaga midfielder Duda barged into Messi to set up his second successful penalty and match Mueller. Messi surpassed the former West Germany striker when Iniesta slipped a perfect long ball between defenders.
"Barcelona tried," said Guardiola, who is stepping down to be replaced by assistant Tito Vilanova at the end of the season. "There wasn't much difference. The league is very long and he who deserves to win, wins. And Madrid was a deserved winner."
Guardiola won the Club World Cup and European Super Cup this season, but even a Copa del Rey final win later this month would do little to ease the disappointment of losing the domestic title after being eliminated from the Champions League by Chelsea.
Earlier, Zaragoza beat Levante 1-0 to keep its hopes alive of avoiding relegation following Rayo Vallecano's 1-0 loss at Mallorca, which scored through Chori Castro in the 62nd minute. Rayo has 40 points, Zaragoza 37 and Sporting Gijon 34.
Also, substitute Carlos Vela's stoppage-time goal gave Real Sociedad a 1-1 draw at 10-man Atletico Madrid to all but end Atletico's hopes of qualifying for next season's Champions League.
Valencia thrashed 10-man Osasuna 4-0 to move three points ahead of Malaga and keep a firm grip on third place and an automatic Champions League qualifying place.
Levante is three points behind Malaga, which is fourth and in the final Champions League qualifying spot. Atletico trails Malaga by five points. Real Betis came from behind to beat city rival Sevilla 2-1.