One down, one to go.
The Spaniard had all but secured the win after Saturday's 20th stage when he saw his lead cut in half but nevertheless headed into the final day — a mainly processional stage — with more than a two-minute advantage on closest rival Fabio Aru. Contador ended up winning by 1 minute, 53 seconds.
Contador had a pink bicycle — the color of the winner's jersey — for the final stage while his Tinkoff-Saxo teammates had pink handlebars on their bicycles and all were wearing pink socks.
Aru finished second overall, with Astana teammate Mikel Landa third, 3:05 behind Contador, who took a total of 88 hours, 22 minutes, 7 seconds to cycle the 3,486 kilometers (2,166 miles) of the three-week race.
A two-time Tour champion, Contador won the Giro in 2008 and was also triumphant in Milan in 2011 but was stripped of that title for testing positive in the 2010 Tour.
The 32-year-old had already confirmed this would be his last Giro.
Iljo Keisse sprinted to victory at the end of the flat 178-kilometer (110.6-mile) leg from Turin to Milan, edging out Luke Durbridge, who gave his break companion a congratulatory hug as they crossed the line.