Cavendish made a poor start to the Tour, but his 24th career Tour stage win launches his bid to win the sprinters' green jersey.
“I'm super happy,” Cavendish said. “Now the pressure's off and hopefully it has started the ball rolling.”
Cavendish stayed near teammate Gert Steegmans' wheel, got in position to attack and held off a challenge from Norwegian Edvald Boasson Hagen. Peter Sagan, who leads the green jersey contest, finished in third place. Cavendish pulled within 35 points in second place overall.
“I'm motivated, I've got good form and a great team around me,” said Cavendish, praising Steegmans. “He did a great job.”
The 84-year-old Andre Darrigade, who won 22 Tour stages as a sprinter, warmly greeted Cavendish after his win.
Cavendish needs one more stage win to tie Andre Leducq for third on the Tour's all-time list of stage winners. He could achieve that Thursday, when the sixth stage again favors sprinters.
He's also eying Bernard Hinault's 28 wins, the second-highest total after Eddie Merckx's record of 34.
While Cavendish was raising his arms in triumph, behind him about a dozen riders hit the tarmac in a crash. It was unclear who caused it.
The 142-mile route featured some small climbs but was otherwise flat, starting out from the tourist beach resort of Cagnes-sur-Mer and finishing in the southern sea port of Marseille.
The pack rolled along at a slow pace until a crash toward the end brought down 15-to-20 riders.
Gerrans held off Sagan to win the third stage on Monday in a sprint finish and helped his Orica Greenedge team to narrowly win the time trial in stage four in a Tour record time on Tuesday. It was enough to take the leader's jersey from Belgian Jan Bakelants.
Gerrans is only the sixth Australian to wear the yellow jersey — the first was Phil Anderson in 1981, To celebrate, Orica Greenedge took the start line with yellow helmets on.
Japanese rider Yukiya Arashiro and Frenchman Kevin Reza formed part of an early six-man breakaway group.
None has even won a Tour stage, so the pack let them go. They opened up a lead of more than 10 minutes, which was whittled down to about 8 minutes when the peloton reached the foot of the day's third small climb.
With the sun out, and little difficult terrain, the average speed for the first four hours was a low 25 mph.
Finally, with a little more than 31 miles left, there was a split in the breakaway group as Arashiro, Alexey Lutsenko of Kazakhstan and Thomas De Gendt of Belgium charged ahead. Reza left the other two behind to join them.
Then, just like on the first stage on Saturday, there was a crash with about 9 miles remaining.
It appeared that BMC rider Brent Bookwalter, sitting in the middle left of the pack, was the first to fall and others tumbled around him. American veteran Christian Vande Velde was among them and received treatment on the side of the road.
The sixth stage on Thursday is a flat 110-mile route from Aix-en-Provence to Montpellier, meaning that Gerrans has a good chance of keeping the yellow jersey.
The race heads into the mountains for the first time in the eighth stage on Saturday from Castres to Ax 3 Domaines in the Pyrenees.