A month after completing a two-year ban for doping, Alberto Contador showed that he was still a force to be reckoned with as he won his second Vuelta a Espana title on Sunday.

The Saxo Bank-Tinkoff rider claimed his fifth Grand Tour victory after he finished in the main pack in Sunday's largely ceremonial stage into Madrid, won in a bunch sprint by Germany's John Degenkolb.

Spanish riders scooped all three top spots overall, with Alejandro Valverde second at one minute 16 seconds and Joaquim Rodriguez in third at one minute 37.

Ireland's Nicolas Roche finished 34th on the final stage, coming home in the main bunch. The Ag2r-La Mondiale rider finished 12th overall, 17:50 behind Contador.

Sunday's victory was Contador's first Grand Tour triumph since he completed a doping ban four weeks ago.

"This is the result of many months of hard work and an incredible level of self-sacrifice," Contador told reporters.

"I feel a real sense of release from pressure, liberated by this win.

"I want to dedicate it to the people who have been with me in the good times and the bad times."

In a dramatic, hard-fought race, Contador showed he was in good condition and keen to make an impact as early as stage three, launching seven separate attacks on the Arrate climb in the Basque Country.

Despite his aggressive racing, Contador could not shake off Rodriguez on the climbs, although he came to within one second of taking the lead at the race's single individual time trial in Pontevedra on stage 11.

Following three difficult mountain stages, culminating in a 23 kilometre ascent to the Cuitu Negru on stage 16, Rodriguez opened up a 28-second overall lead.

However, Contador bounced back with a surprise attack on stage 17 to Fuente D that netted the Spaniard both the stage win and the overall lead.

The final stage, a 115 kilometre stage from Cercedilla to Madrid, was won by Germany's Degenkolb in a bunch sprint, with Italy's Elia Viviani in second and Daniele Bennati in third.

"I suffered a lot on the final climbs of the race, but I managed to get through to the finish ok," Degenkolb said after winning his fifth stage in the race.

"I'm the first German to win so many stages in a single Vuelta, and I'm very proud of that."

Contador's next objective will be to take part in the World Championships, starting with the team time trial event on 16 September in Valkenberg, Netherlands.