Madrid:The David Beckham era at Real Madrid ended with a Spanish league title.
The England midfielder helped the team end a four-year stretch without a major trophy, giving Madrid its 30th league title.
The nine-times European champions inched out arch rivals Barcelona, in overall standings on the basis of a better head-to head count, to clinch their first La Liga title in four years, by beating Real Mallorca 3-1 in Madrid on Sunday.
Barcelona, which had won the last two titles, beat Gimnastic Tarragona 5-1 on the final day of the season, but Madrid claimed the title on head-to-head results.
The match marked the final appearances of David Beckham and Roberto Carlos, who signed off with a championship medal in front of 76,000 adoring fans at the Bernabeu.
Beckham was replaced Sunday before Madrid started its comeback - it was his substitute, Jose Antonio Reyes, that scored two of the three goals - but the title will always be linked to the England midfielder.
Madrid coach Fabio Capello benched Beckham after the Englishman signed a contract to play for the Los Angeles Galaxy.
But when Beckham finally returned to the lineup weeks later, he scored in a 2-1 win over Real Sociedad. Madrid lost only once in its next 17 games.
"A major fault of mine this season was not recognizing Beckham's potential," Capello said Sunday. "It was the biggest mistake, the most regretting," he added.
Beckham's playing time wasn't the only problem Madrid overcame.
In February, the team was in fourth place, six points behind Barcelona. In early March, Madrid was knocked out of the Champions League in the second round for the third straight year.
And two days after the Champions League exit, defender Roberto Carlos announced he would be leaving at the end of his 10th season. Ronaldo, another Brazilian, had left in January for AC Milan.
But Madrid's turnaround really took off during a league match at Barcelona in March, when an inspired team performance saw Madrid draw 3-3 at the Nou Camp.
After that game, Beckham's crosses were consistently finding their targets, and Madrid went undefeated in the 11 games he played after being reinstated by Capello.
Fans also quickly forgot about Ronaldo as Van Nistelrooy scored 10 times in the last eight games to clinch the Pichichi award for the league's top scorer with 25 goals.