(CNN) -- Alberto Contador celebrated his first victory since returning from a doping ban as he won his home Vuelta A Espana for the second time on Sunday.
The Spanish rider, who was stripped of his 2010 Tour de France and 2011 Giro d'Italia victories after testing positive for a banned steroid, finished one minute 16 seconds clear of compatriot Alejando Valverde in the third and final grand tour of the cycling season.
Valverde won the Vuelta in 2009, but has like Contador just returned from a two-year suspension after being involved in the Operacion Puerto blood doping scandal.
The 29-year-old Contador completed the three-week, 3,300-kilometer event in 84 hours 59 minutes 49 seconds to follow up his 2008 success and hold onto the red jersey.
"Thanks to all of you who have been there, both in good and bad times! This victory is yours!" the Saxo Bank team rider wrote on his Twitter page after finishing 54th in the peloton in the 21st stage along the streets of Madrid.
Movistar's Valverde came home sixth to deny third-placed Joaquin Rodriguez the points classification jersey, while German sprinter John Degenkolb came home first to earn his fifth stage win.
It was the second year in a row that Rodriguez was denied the points jersey on the final day.
The race marked the end of the careers of France's David Moncoutie, a four-time winner of the Vuelta's mountain classification category, and fellow veteran Grischa Niermann of Germany, who were allowed a honorary run at the front of the field for the first intermediate sprint.
The field lacked many of the top names from July's Tour de France, which was won by Bradley Wiggins, but his Team Sky colleague Chris Froome did take part and finished fourth overall -- more than 10 minutes behind Contador.
Contador is one of cycling's biggest stars, and his controversial ban for use of clenbuterol -- small amounts were found in tests during the 2010 Tour de France -- was another blow for the sport, which has been plagued by drug scandals.
Seven-time Tour champion Lance Armstrong has been stripped of his titles after last month refusing to defend himself against doping charges laid against him by the U.S. Anti-Doping Agency.