“I would like to inform you about two things. One is that I will participate in the next Vuelta a España from August 19 and the second is that it will be my last race as a professional cyclist,” Contador, 34, said in a video posted on his Instagram account.
Contador is one of the most decorated cyclists of all-time with seven Grand Tour victories in total to his name and is one of only six riders to win all three of the Tour de France, Giro d'Italia and Vuelta a españa.
“It's a decision that I have thought through and I don't think there is a better farewell than in the home race and in my country,” Contador added.
“I'm sure they will be three wonderful weeks, enjoying all your affection, and I can't wait to get started.”
However, Contador's career was also overshadowed by a positive test for the banned substance Clenbuterol which saw him banned for two years in 2012 and stripped of victory in the 2010 Tour de France and 2011 Giro d'Italia.
He claimed his failed test had come about from eating contaminated meat.
Having initially announced his intention to retire at the end of 2016, his impressive form last season encouraged Contador to continue for 2017 as he switched teams to Trek-Segafredo.
However, he endured a disappointing Tour de France in July as he finished in ninth place and nearly nine minutes off Chris Froome.
Froome will also be the man to beat in the Vuelta if Contador is to have a glorious goodbye from the sport as the Britain headlines a strong field also featuring Fabio Aru, Vincenzo Nibali and Romain Bardet.