Spain's Alberto Contador has won the Giro d'Italia for the second time, finishing six minutes and 10 seconds ahead of Italy's Michele Scarponi.
Britain's David Millar won the final stage in Milan for his Garmin team, ahead of Dane Alex Rasmussen (HTC-Highroad) and Contador in third place.
The Spaniard, cycling for the Saxo Bank team, was the pre-race favourite.
His hearing on a doping charge has been postponed until after the Tour de France in July.
He was originally suspended by the Spanish cycling authorities in September for allegedly taking a prohibited substance, but in January his one-year ban was rescinded pending a further hearing with fresh evidence.
Contador first took the Giro's pink jersey in 2008.
In this year's race he captured two stage wins and held the leader's jersey for 13 days on his way to a victory which owed much to his excellent performance in the mountains.
After finishing first on the slopes of Mount Etna, Sicily, on the ninth stage to don the pink jersey for the first time, Contador took charge of the race.
He celebrated Sunday's win by beating his chest as he crossed the line, firing the traditional pistol shot in the air.
Contador also took the red jersey for winning the most points, ahead of Lampre's Scarponi.
Last year's winner, Italian Ivano Basso did not take part in his home turf event this time around.
"It is an amazing feeling to win the Giro here today and it is a dream finale," the Madrid-born rider said.
"My team was really supportive throughout and we didn't really have a bad day," he added.
The 28-year-old now has his hopes up of winning a fourth Tour De France title, which will draw him level with Lance Armstrong for Grand Tour victories.
Czech Roman Kreuziger took the white jersey for best young rider on the Giro, and Italian Stefano Garzelli claimed the green jersey for king of the mountains.
This year's Giro was overshadowed by the death of Belgian rider Wouter Weylandt, who died following a crash on the third stage.
Giro D'Italia overall standings:
1. Alberto Contador (Spain/Saxo Bank) 84hrs 5mins 10secs
2. Michele Scarponi (Italy/Lampre) +6:10
3. Vincenzo Nibali (Italy/Liquigas) +6:56
4. John Gadret (France / AG2R) +10:17"
5. Joaquim Rodriguez (Spain / Katusha) +11:05"
6. Roman Kreuziger (Czech Republic / Astana) +11:28"
7. Jose Rujano (Venezuela / Androni Giocattoli) +12:12"
8. Denis Menchov (Russia / Geox) +12:18"
9. Steven Kruijswijk (Netherlands / Rabobank) +13:51"
10. Kanstantsin Sivtsov (Belarus / HTC - Highroad) +14:10"
21st stage result:
1. David Millar (Britain / Garmin) 30mins 13secs
2. Alex Rasmussen (Denmark / HTC - Highroad) +7secs
3. Alberto Contador (Spain / Saxo Bank) +36secs