His fellow Italian Vincenzo Nibali retained the overall leader's yellow jersey as American contenders Tejay van Garderen and Andrew Talansky took tumbles. The Slovakian Peter Sagan was second and France's Tony Gallopin third.
"I am very happy to have won after the hard luck we had for the last six days and especially Mark Cavendish's crash," Trentin said.
"We came to the Tour for Mark to take the yellow jersey in his mother's home town and it ended in a crash. The next morning, he gave us a very good speech, telling us that we should win a stage, that we could do it. We did it at last."
Van Garderen, 11th in the race at the start, fell with about 15km to go and lost 1:03 to the other favourites, dropping to 18th overall.
Injuries sustained in the same crash forced his Colombian BMC team-mate Darwin Atapuma to pull out of the race.
"It's definitely not a good day for the team," Van Garderen said. "We were keeping Atapuma fresh for the mountains and to lose him is tough. He banged his knee pretty hard."
Garmin-Sharp's Talansky fell in the final straight after colliding with the Australian Simon Gerrans. He got back on his bike and as, the incident happened inside the final 3km, was credited with the same time as the bunch. He moved up to eighth overall but was furious at Gerrans, who apologised afterwards.
"Gerrans moved right over on to Andrew's front wheel as Andrew was trying to get out of the way," said Jonathan Vaughters, Garmin-Sharp's team manager.
"The first thing he said was, 'I want an apology from Simon Gerrans'. That means he is fine, He will be a bit stiff tomorrow but he is all right."
The sprinters dropped out when the peloton reached Col de Maron, a short fourth-category climb 20km from the finish. In the final kick, Sagan and Greg Van Avermaet powered away from the pack before being caught. Sagan was then beaten by a tyre's length by Trentin who also won a stage in Lyon last year.
The Tour hits the mountains today as a 161km trek from Tomblaine to Gerardmer takes riders on to the Vosges massif.