An exciting finale saw the world champion from Team Sky come from behind to pip Germany's Greipel of Lotto-Belisol, with another former HTC rider – Australian Matt Goss (Orica-GreenEdge) – settling for third place.
It was Cavendish's 21st career win on the Tour – but his first outside France. The 26-year-old Manxman is now just one victory shy of Lance Armstrong's tally of 22 wins on the world's greatest cycling race.
The win was all the more impressive because Cavendish was forced to do it without the support of his Sky team-mates, whose primary focus in this year's Tour is to protect their man for the GC, Bradley Wiggins.
Greipel looked to be the firm favourite, negotiating the final demanding bends of the 207.5km through Belgium with two team-mates at his disposal.
But Cavendish expertly latched on to the wheel of his main rival, and when the German opened up the sprint in the closing 100 metres, Cavendish turned on the style to power past his rival and take the win by a whisker.
"I was completely alone in the last kilometre after Bernie [Eisel] had kept me there coming into the final. I had to do it by myself, but I came in to the race with no pressure so I could be plucky about it," said Cavendish.
"With a team, I'd be expected to win a sprint like that. But when I'm a bonus rider, it's different. It's a great feeling."
Switzerland's Fabian Cancellara (RadioShack-Nissan) retained the yellow jersey on a day which saw no major incidents within the peloton. Team Sky's Wiggins is in second place and Frenchman Sylvain Chavanel (Omega Pharma-Quick Step) in third – both seven seconds behind the Swiss.
France's Anthony Roux (FDJ-BigMat) attacked the peloton on the 22km mark and was soon joined by compatriot Christophe Kern (Europcar) and Denmark's Michael Morkov (Saxo Bank-Tinkoff Bank).
Over undulating roads basked in Belgian sun, the trio built up a maximum lead of just under eight minutes. Morkov, wearing the polka dot jersey after his exploits in Sunday's opening road stage, consolidated his lead in the king of the mountains competition by taking the solitary point available at the summit of the day's only test, the cobbled Cat.4 Cote de la Citadelle de Namur climb.
The trio were still out in front when the race reached the intermediate sprint, which was won by Kern ahead of Roux. Combined work on the front of the peloton by the teams of the main sprinters saw the break split up before the final 30km.
Roux held on for another 15km before giving in to the inevitable. Meanwhile, the fast pace was too much for one of the pre-stage favourites, Germany youngster Marcel Kittel of Argos-Shimano, who was dropped off the back of pack soon afterwards.
Lotto Belisol has Greg Henderson, Adam Hansen and Marcel Sieberg working hard for Greipel as the peloton roared into Tournai – but it was not enough to keep Cavendish at bay.
Cavendish proved the strongest of his former HTC team-mates, with Goss short by half a bike length to take third behind Greipel and the victorious world champion.
Despite losing Kittel, Argos-Shimano managed a fourth-placed finish through Tom Veelers, while Italian veteran Alessandro Petacchi (Lampre) pipped stage one winner Peter Sagan (Liquigas) for fifth.
Sagan picked up enough points to move top of the green jersey points standings. The Slovakian has 78 points, with Cavendish in second place on 63 points.
Tuesday’s 197km stage three from Orchies to Boulogne sees the race enter French soil for the first time this year and features six small climbs towards the finish.