Quick-Step Floors' Trentin reeled in and surged past Spain's Juan Jose Lobato, with Belgium's Tom van Asbroeck third in Tarragona.
Four-time Tour de France champion Froome finished in the bunch on the 198km stage from Escaldes-Engordany.
The Team Sky rider, 32, still holds a two-second lead.
Spain's David de la Cruz, Irishman Nicolas Roche and American Tejay van Garderen are his closest challengers.
Froome is aiming to become only the third rider to win the Tour and the Vuelta in the same year.
Trentin, 28, has now won a stage in all three Grand Tours, adding to victory at the 2016 Giro d'Italia and wins in the 2013 and 2014 Tours de France.
"I'm really proud to have done this with this team," said Trentin.
"I was really looking for this stage win as I've been going well in the last part of the season."
Quick-Step have won two of the four stages of this year's Vuelta, following Yves Lampaert's victory on stage two.
They held the race together to set up Trentin for a bunch sprint after the breakaway duo of Stephane Rossetto and Diego Rubio were caught inside the final 10km.
Britain's Simon Yates moved up to 10th in the general classification, 48 seconds behind Froome, after Italy's Domenico Pozzovivo crashed late on and lost three minutes 25 seconds.
Yates' twin brother and Orica-Scott team-mate Adam remains eighth overall, a further nine seconds ahead, while former winner Vincenzo Nibali of Italy still trails Froome by 10 seconds.
Wednesday's fifth stage takes the riders 176km over rolling terrain from Benicassim to Alcossebre, culminating in a short but steep uphill finish.
1. Matteo Trentin (Ita/Quick-Step Floors) 4hrs 43mins 57secs
2. Juan Jose Lobato (Spa/Team LottoNL-Jumbo) Same time
3. Tom van Asbroeck (Bel/Cannondale-Drapac)
4. Edward Theuns (Bel/Trek-Segafredo)
5. Jens Debusschere (Bel/Lotto Soudal)
6. Sacha Modolo (Ita/Team UAE Emirates)
7. Lorrenzo Manzin (Fra/FDJ)
8. Soren Kragh Andersen (Den/Team Sunweb)
9. Youcef Reguigui (Alg/Team Dimension Data)
10. Jetse Bol (Ned/Manzana Postobon)
1. Chris Froome (GB/Team Sky) 13hrs 37mins 41secs
2. David de la Cruz (Spa/Quick-Step Floors) +2secs
3. Nicolas Roche (Ire/BMC Racing Team)  Same time
4. Tejay van Garderen (US/BMC Racing Team)
5. Vincenzo Nibali (Ita/Bahrain-Merida) +10secs
6. Esteban Chaves (Col/Orica-Scott) +11secs
7. Fabio Aru (Ita/Astana Pro Team) +38secs
8. Adam Yates (GB/Orica-Scott)+39secs
9. Romain Bardet (Fra/AG2R La Mondiale) +48secs
10. Simon Yates (GB/Orica-Scott) Same time
Italy's Matteo Trentin sprinted to victory on stage four of the Vuelta a Espana as Britain's Chris Froome retained the leader's red jersey.