John Degenkolb (Giant-Alpecin) had to wait a long time for a Grand Tour stage win in 2015 but the German beat a depleted field in Madrid to seal his 10th Vuelta a España win.
Degenkolb looked to have gone too early in the final sprint but found a second wind to hold off Danny Van Poppel (Trek) and Jempy Drucker (BMC) on the line.
Fabio Aru (Astana) finished safely in the pack to win his first Grand Tour at only his fifth attempt.
After the traditional leisurely start to the stage, the real racing got going when the riders hit the circuit in Madrid.
First up came the intermediate sprint, which Alejandro Valverde (Movistar) won. Green jersey incumbent Joaquim Rodriguez (Katusha) suffered a puncture before the sprint, meaning Valverde leapfrogged his fellow Spaniard in the classification.
A six-man breakaway was formed immediately after the sprint, with Omar Fraille – who has led the king of the mountains classification from start to finish – in its midst.
As the peloton gobbled up the futile breakaway, Etixx-Quick Step’s Iljo Keisse went out on his own heading into the final laps. Keisse was soon passed by Alexis Gougeard (Ag2r La Mondiale), winner of stage 19, and Christian Knees (Team Sky) also tried his luck.
The stage was destined to end in a sprint, though, and with most of the pure sprinters abandoning the race when the high mountains set in, Degenkolb was favourite for the win.
His team set him up well and the German opened his sprint with 500m to go. Van Poppel looked to have the beating of him, but Degenkolb held on.
Degenkolb had recorded 11 top-10 finishes in Grand Tours this season before the final stage without notching up a win. The Milan-San Remo and Paris-Roubaix winner rounded off his stage racing season with a bang and put himself in a good position for the upcoming World Championships
Vuelta a España stage 21, Alcalá Alcalá de Henares – Madrid (98.8km)
1. John Degenkolb (Ger) Giant-Alpecin, 2-34-13
2. Danny Van Poppel (Ned) Trek Factory Racing
3. Jempy Drucker (Lux) BMC
4. Daryl Impey (RSA) Orica-GreenEdge
5. Tosh Van Der Sande (Bel) Lotto-Soudal
6. Maximiliano Richeze (Arg) Lampre-Merida
7. Nicolas Maes (Bel) Etixx-Quick Step
8. Kristian Sbaragli (Ita) MTN-Qhubeka
9. Kevin Reza (Fra) FDJ
10. Tom Van Asbroeck (Bel) LottoNL-Jumbo, all at same time
Overall classification after stage 21
1. Fabio Aru (Ita) Astana in 85-36-13
2. Joaquim Rodriguez (Spa) Katusha at 56s
3. Rafal Majka (Pol) Tinkoff-Saxo at 1-09
4. Nairo Quintana (Col) Movistar at 1-42
5. Esteban Chaves (Col) Orica-GreenEdge at 3-10
6. Tom Dumoulin (Ned) Giant-Alpecin at 3-46
7. Alejandro Valverde (Spa) Movistar at 6-47
8. Mikel Nieve (Spa) Team Sky at 7-07
9. Daniel Moreno (Spa) Katusha at 7-12
10. Louis Meintjes (RSA) MTN-Qhubeka at 10-26