The last of the escapees was swallowed up with 4 km to go, setting up the predicted mass sprint.
Chaos hit the final straight when a crash stopped much of the field from continuing on to the line.
But just ahead Cavendish – who is recovering from bronchitis – timed his sprint to perfection and blasted out in front to claim top honours for the first time in the 100th edition of cycling’s most prestigious race.
The Manx Missile’s acceleration left Norway’s Edvald Boasson Hagen in second place and Slovakian Peter Sagan in third.
Australian Simon Gerrans easily retained the leader’s yellow jersey ahead of Orica-GreenEdge teammates Daryl Impey and Michael Albasini.
Thursday’s stage six is a 176.5 kilometre ride to Montpellier.