Viviani edged Alexander Kristoff and Caleb Ewan who were second and third on a 1.5km home straight with all the top sprinters and their lead-off trains, were active over a nervy finale.
The 213.5-kilometre flat route from Reims to Nancy did not pose any major difficulty and was a flawless opportunity for sprinters to get a stage win, a day after Viviani's teammate Julian Alaphilippe seized the yellow jersey with a solo effort. The bunch finish meant there was no change at the top of the general classification, which Alaphilippe leads by 20 seconds from Jumbo-Visma's Wout Van Aert.
"A Tour stage was the only win I was missing, now I've got it", Viviani said happily.
Viviani has five Giro d'Italia and three Vuelta a Espana stage wins to his name, but he has been made to wait for one in Le Tour. It was the big goal of the year.
"It's actually only starting to sink in now that I have the jersey", said the former soldier who was close to tears.
In front of the Reims cathedral with 69km to go, the deficit of the peloton was below two minutes with Jumbo-Visma and Deceuninck-Quick Step still at the front.
Apple disables Walkie-Talkie app due to snooping vulnerability
This bug has since been patched, and there's no reason to suspect that the same won't be done for the walkie-talkie bug. Gadgets Now did try to use the Walkie Talkie app on two Apple Watch and it didn't function.
"No one wins the Tour on five-second sprint finishes but obviously it would be better not to have lost that", Thomas said.
Overnight leader and surprise victor of the opening stage Mike Teunissen, was dropped by the main pack at the moment of Alaphilippe's attack and drifted home five minutes off the pace. Kristoff opened up the sprint in the final stretch, but could not hold off Viviani on the left side of the road. Italian Viviani triumphed in the first pure sprint opportunity of the Tour after the uphill effort in Brussels on the opening day.
"I enjoyed every kilometre today and at the end we got a handsome victory so it was unbelievable", Alaphilippe said.
Defending champion Geraint Thomas had a quiet day as he, co-captain Egan Bernal and their Ineos teammates all finished in the pack.
"It is what it is", Thomas said. The breakaway riders swapped turns efficiently until Wellens attacked with 48km to go before the climb of Nanteuil-la-Forêt.
The trio was eventually caught with 17 kilometers left, in the small Cote de Maron climb, leaving the spotlights on the fastest men of the peloton.