Midfielder David Beckham capped his Real Madrid career with a league title.
Beckham celebrates his triumph draped in a flag of St George
Beckham, 32, has been at Real for four seasons but the 3-1 win over Mallorca sealed a first major Spanish honour for the United States-bound star.
A brace from Jose Antonio Reyes, who is on loan from Arsenal, and an Angelos Basinas own goal clinched Real's crown.
It is the club's first La Liga success in four years and they edged out Barcelona, who beat Gimnastic 5-1, because of their head-to-head record.
Beckham, who is set to join LA Galaxy, was not on the pitch at the final whistle having been replaced by Reyes, but he joined the raucous celebrations at the Bernabeu.
"I couldn't have dreamt it any better," said Beckham.
"It's been about winning the title for the last six months - and we've deserved it tonight.
"It's been an incredible experience, but all I remember now is the great things. Winning this tonight now puts to bed everything else."
The England star was joined by his three sons on the pitch and was given an emotional send-off, as was Brazilian left-back Roberto Carlos, who is joining Fenerbahce after 11 years in the Spanish capital.
Striker Ruud van Nistelrooy limped off after 33 minutes but he refused to let that dampen his celebrations after winning the league in his first season at the club.
"It is a dream come true. It is incredible. It is hard to explain the joy that I feel. I don't have the words," said the Dutchman.
"I don't even feel any pain. We're champions and the tear doesn't even hurt. All we have left to do is go to the party."
Thousands of Real Madrid fans converged on the Cibeles fountain in the centre of the Spanish capital to celebrate their 30th title triumph.
Elated fans flooded down the Paseo de la Castellana from the Bernabeu stadium for the first time in four years to cheer their heros.
The players followed them white open-top bus and when they got to the historic fountain they celebrated on to a specially constructed catwalk.
Club captain Raul, celebrating his fifth league title with Real, was lifted on to the monument by a crane and draped a Spanish flag and a club scarf around the statue of the goddess as his team mates looked on.
The Real Madrid players celebrate their victory on an open-top bus
But for much of the night it looked as if Barcelona would be the team and city celebrating come the final whistle.
The defending champions ran riot against relegated Gimnastic and were 3-0 up at the break, with goals from Carles Puyol, Lionel Messi and Ronaldinho.
Meanwhile, Real were struggling and there was a growing edge of anxiety among a Bernabeu crowd that included actor Tom Cruise and tennis star Rafael Nadal.
Fabio Capello's team had an early scare when Juan Fernando Arango slammed a shot on to the Real woodwork in the opening minute and they fell behind when Fernando Varela broke the offside trap to score on 17 minutes.
And injury was added to insult when Real's leading scorer Ruud van Nistelrooy hobbled off with a hamstring injury a little over half-an-hour into the game.
After Beckham had curled an effort on to the Mallorca crossbar, Varela had a chance to put the visitors firmly in the driving seat but he poked his effort wide and Real pounced on their lifeline.
Beckham, struggling with an ankle injury picked up on England duty, made way for Reyes, who side-footed home with his first touch from Gonzalo Higuain's pull-back on 68 minutes.
Mahamadou Diarra's downward header trickled over the line after a double deflection off goalkeeper Miguel Angel Moya and defender Basinas before Reyes curled in a delightful third goal from the edge of the area.
While Real left it late, with those two goals coming in the final 10 minutes, Barcelona were always in control at Gimnastic, with Messi and Gianluca Zambrotta adding second-half strikes.
However, their efforts proved to be in vain as Real kept their advantage at the top of the table, courtesy of a 2-0 win at home over the Catalans in October and a 3-3 draw at the Nou Camp in March, to land their 30th Liga title.
Sevilla started the final day with an outside chance of scooping the silverware but they lost 1-0 at home to Villarreal.
At the other end of the table, Real Sociedad and Celta Vigo were relegated with Gimnastic.