Trentin wins his fourth stage of the race after out-sprinting the field on the final straight of the finishing circuits in the Spanish capital.
Froome adds Vuelta victory to his four Tour de France titles, and becomes only the third rider in history to win the Tour de France and the Vuelta in the same year.
Vincenzo Nibali (Bahrain-Merida) claimed second place overall, with Ilnur Zakarin (Katusha-Alpecin) also finishing safely to secure his first Grand Tour podium with third place.
How it happened
As expected, it was a procession for the peloton for much of the 117.6km into Madrid, allowing for the jersey wearers to pose for photos and Team Sky to celebrate with some beer from the team car.
Things didn't get going until mid-way through the first lap of the 5.6km circuit in the centre of Madrid, after bunch had allowed the retiring Alberto Contador (Trek-Segafredo) to ride the final few kilometres solo into the city and cross the finish for the first time by himself in celebration.
Sky were the first team to kick the race into action, as they began their mission of trying to stop Matteo Trentin from making a late grab for Chris Froome's green jersey of the points competition.
Trentin sat 26 points down on Froome in third place in the classification ahead of the stage, and needed to stop Froome from grabbing any points at the intermediate sprint and win the stage with Froome outside of the top-14 to claim green.
Quick-Step, clearly unhappy with Sky trying to ruin their day, eventually organised an amassed their strongest riders to the front.
The sprint point came on the third lap with 33.6km to go and red jersey Froome was the first to launch his sprint to try and grab some points. There was nothing he could do to stop the power of Quick-Step though, who in the end managed to get Trentin across the line to take four points with another their riders just behind.
Sky's Gianni Moscon claimed third to take the final point up for grabs.
Once that fight was over, a breakaway then tried to get away in earnest, with Rui Costa (UAE Team Emirates), Alessandro De Marchi (BMC) and Nicholas Schultz (Caja Rural) managed to get away with a small gap.
They held their gap for some time with Schultz the first to drop away. De Marchi and Costa were able to hold on until the start of the final lap with 5.5km to when they were enveloped by the peloton as the sprinter's teams prepared their fast men for the finish.
Quick-Step then dominated the front of the pack in the final 3km, leading Trentin right into the final 250 or so metres where he began his sprint very early.
The Italian launched through the centre of the road with Lorenzo Manzin (FDJ) and Soren Kragh Andersen (Sunweb) challenging him, but no-one was able to stop him from claiming his fourth stage victory of the race.
Behind, Chris Froome unexpectedly got himself in the mix of the bunch sprint and snuck home in 11th place, enough to hold onto the green jersey by two points (158 to 156) over Trentin.
More importantly, Froome was able to make it home safely to claim his fifth career Grand Tour victory, his first at the Vuelta.
There was one small change on GC, with Alberto Contador slipping down to fifth behind Wilco Kelderman (Sunweb) after dropping back to celebrate over the final finish line of his career.
Vuelta a España 2017, stage 21: Arroyomolinos to Madrid (117.6km)
1. Matteo Trentin (Ita) Quick-Step Floors, in 3-06-29
2. Lorenzo Manzin (Fra) FDJ
3. Søren Kragh Andersen (Den) Team Sunweb
4. Tom Van Asbroeck (Bel) Cannondale-Drapac
5. Ivan Garcia (Spa) Bahrain-Merida
6. Magnus Cort Nielsen (Den) Orica-Scott
7. Kenneth Vanbilsen (Bel) Cofidis, Solutions Credits
8. Sacha Modolo (Ita) UAE Team Emirates
9, Michael Schwarzmann (Ger) Bora-Hansgrohe
10. Daniel Hoelgaard (Nor) FDJ, all same time
Final general classification
1. Chris Froome (GBr) Team Sky, in 82-30-02
2. Vincenzo Nibali (Ita) Bahrain-Merida, at 2-15
3. Ilnur Zakarin (Rus) Katusha-Alpecin, at 2-51
4. Wilco Kelderman (Ned) Team Sunweb, at 3-15
5. Alberto Contador (Esp) Trek-Segafredo, at 3-18
6. Wout Poels (Ned) Team Sky, at 6-59
7. Michael Woods (Can) Cannondale-Drapac, at 8-27
8. Miguel Angel Lopez (Col) Astana, at 9-13
9. Steven Kruijswijk (Ned) LottoNL-Jumbo, at 11-18
10. Tejay van Garderen (USA) BMC Racing, at 15-50
King of the Mountains
Davide Villella (Cannondale-Drapac)
Chris Froome (Team Sky)
Chris Froome (Team Sky)
Thank you for reading 20 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1