Sagan, who pulled on the coveted shirt for the first time, used his power on the 1.9-kilometre Cote de la Glacerie leading to the finish line to claim the win.
Frenchman Julian Alaphilippe, who started the final sprint, was second in the 183-kilometre stage between Saint-Lo and Cherbourg-en-Cotentin in Normandy, with Spaniard Alejandro Valverde in third place.
A debutant at the Tour, Alaphilippe made his move on the left side of the road. Sagan waited patiently in his wake before timing his acceleration to perfection to overtake the Frenchman and win by a bike’s length.
“I’m very surprised I won because I was thinking there were still two guys in front,” said Sagan, who did not celebrate as he crossed the line. “The team today made a very big job. Roman Kreuziger did the last climb full gas and in the final I did my best – for third place!
“It’s unbelievable. I’m already wearing a very nice jersey, but yellow is something special.”
Two-time Tour de France winner Alberto Contador, who crashed for a second consecutive day, was dropped in the final climb and lost 48 seconds.
Belgian Jasper Stuyven, who was part of an early breakaway group that formed after the start of the stage, almost thwarted Sagan’s plans when he tried to go for a solo win, but was reined in with 500 metres left.
Overnight leader Mark Cavendish, pictured, finished just behind BMC co-leader Richie Porte, who was among the big losers of day, crossing the finish line 1 minute and 45 seconds behind Sagan after a puncture.
Cavendish started the day with a four-second lead over Marcel Kittel, with Sagan in third place, six seconds behind. The Slovak rider now has an eight-second lead over Alaphilippe, with Valverde in third place ten seconds back.
Chris Froome, last year’s Tour winner, is fifth overall after Sunday’s stage, 14 seconds behind Sagan.
All 198 riders took the start in Saint-Lo under grey skies but Cavendish brought a splash of colour to the scene.
Wearing yellow for the first time, the Briton marked the special occasion with a customised bike featuring yellow handlebar and pedals.
Stuyven and three other riders immediately broke away from the peloton on slippery roads near the English Channel as rain started to fall. Paul Voss, Vegard Breen, Cesare Benedetti and Stuyven built a lead of about six minutes before the peloton started to pull them back. Voss was made to pay for his efforts and was dropped in the climb to the summit of the Cote de Montpinchon.
He managed to rejoin the leading group while a crash split the main peloton in two after 60 kilometres. Spaniard Joaquim Rodriguez and Contador, who suffered cuts and bruises on his right shoulder in a crash during Stage 1, were among the riders caught in the incident.
Contador fell on the same shoulder and was forced to change bike. He was helped back into the pack by five Tinkoff teammates as the pace slowed down at the front.
“It’s not ideal but he’s fine,” Tinkoff sports director Sean Yates said. “It’s not good to fall two days in a row but we hope this was the last time.”
The pace in the bunch barely moved until 55 kilometres to go when Cavendish’s Dimension Data outfit started to push forward.
The peloton’s chase started a bit late, as the final battle shaped up with rain falling again and Stuyven almost upsetting all the favourites.