Cavendish secured a new contract with his former Deceuninck Quick Step team for this year after returning from a bout of depression and several seasons of struggles on and off the bike.
But he was not expected to ride in the Tour and did not train specifically for the three-week race. He was a late call-up last month as a replacement for Sam Bennett, the best sprinter of last year’s Tour.
Cavendish has never won the Tour de France. Merckx won it five times.
Known as "The Manx Missile" as he comes from the Isle of Man, Cavendish jostled for position in the last two kilometers to stay on the wheel of lead-out man Michael Morkov.
He looked trapped in traffic with 300 meters left but zigzagged to the front and comfortably won ahead of Morkov. Jasper Philipsen was third.
"I can't even think about (the record). I’m afraid I’m so dead after 220 kilometers in that heat, that wind and that finale," Cavendish said.
"I went deep, I went so deep there. The boys were incredible. I can’t believe it. A lot of the day it didn’t feel like it, but it had to happen because I had the guys riding like they were. I was so on the limit there."
There was no significant change in the general classification as race leader Tadej Pogacar enjoyed a quiet day in the peloton. Pogacar kept his 5:18 lead over second-placed Rigoberto Uran, with Jonas Vingegaard in third, 5:33 off the pace.
The race animated immediately with a flurry of attacks in the early stages of the 220-kilometer trek in southern France. But Cavendish’s teammates set a fast tempo at the front to prevent large group of riders from breaking away, determined to ensure a mass sprint in the end.
They responded to every dangerous move and relaxed only when a trio of riders formed, knowing that it would be impossible for them to beat the chase of the pack later in the day.
Omer Goldstein, Pierre Latour and Sean Bennett worked well together but were kept on a tight leash.
In the shadow of large plane trees scattered across the route through the Languedoc vineyards, the leading trio was reduced to a pair when Latour and Goldstein dropped Bennett.