Cavendish sat on the wheel of Etixx-QuickStep's Kittel as they came into Montauban, and launched himself forward in the final 200 metres.
Finishing fastest of all was Fortuneo-Vital Concept's McLay but the 24-year-old ran out of road as Team Dimension Data's Cavendish punched the air for the third time this week.
The 31-year-old has enjoyed some fantastic Tours in the past, winning six stages in 2009 and five each in 2010 and 2011, but has never before collected three wins in the first six days.
"Oh my god, that was terrifying," Cavendish said. "That was like the old days, wheel surfing. I was a little too far back going into that so it was just carnage in the final. I wanted Kittel's wheel and I was fighting for it.
"I knew it would be the right thing to go early because it was slightly downhill, I put the bigger gear on again but I maxed out and should have put a bigger gear on. I held on and held Kittel off, did to him what he's done to me over the last three years."
Cavendish's win on the first stage to Utah Beach on Saturday put him in the yellow jersey for the first time in his career, and this victory here puts him back in green as he moves back to the top of the points classification ahead of Tinkoff's Peter Sagan.
BMC's Greg Van Avermaet finished safely in the pack to retain the yellow jersey he took on Wednesday.
Three victories matches the number of Tour stage wins Cavendish enjoyed in the last three years - a record which led many to suggest his day had passed as Kittel and Andre Greipel came to dominate.
Cavendish has spent much of this season preparing to race on the track at the Rio Olympics, and admitted on the eve of the Tour he did not know how it would affect his form on the road.
Three stage wins out of six gives a fairly clear answer.
McLay had finished 10th on stage one, ninth on stage three and seventh on stage four - needing little time to acclimatise to the biggest race in cycling.
Prior to this stage, his team manager Emmanuel Hubert had promised McLay would "dare to challenge" the world's best sprinters and McLay certainly delivered as he beat Katusha's Alexander Kristoff and Sagan to the line.
After Wednesday's initial skirmishes in the general classification battle, Thursday's stage profile invited the sprint finish.