The Liquigas youngster counter-attacked Cancellara's brave break on the last of five Cat.4 climbs to take the biggest win of his career, with Team Sky's Edvald Boasson Hagen finishing in third just ahead of the returning peloton.
Twenty-two-year-old Sagan nonchalantly put his hands on his hips before performing a little jig as he crossed the line at the end of the long 198-kilometre stage through Belgium.
Victory for Sagan also gave cycling's current golden boy the lead in the green jersey points standings. It was the Slovak national champion's 14th win of the season and his first in the Tour, following a hat-trick of stage wins on last year's Vuelta a Espana, his debut Grand Tour.
RadioShack’s Cancellara, who won Saturday's opening prologue time trial in Liege, retains his seven-second lead over Britain’s Bradley Wiggins (Team Sky) in the GC.
Four Frenchmen – Yohann Gene (Europcar), Maxime Bouet (Ag2r-La Mondiale), Nicolas Edet (Cofidis) and Anthony Delaplace (Saur-Sojasun) – attacked just moments after the stage start in Liege alongside Spaniard Pablo Urtasun (Euskatel-Euskadi) and Michael Morkov (Saxo Bank-Tinkoff Bank) of Denmark.
The six leaders built up a maximum lead of 4:50 over the winding and hilly roads of the Ardennes region in Belgium – despite at one point being held up by a railway level crossing.
Dane Morkov picked up the solitary points available over three of the day's five climbs to take the first polka dot jersey of the 99th edition of the Tour de France.
An early crash involving Tony Martin (Omega Pharma-Quick Step) and Robbie Hunter (Garmin-Sharp) saw Germany's Martin needing to receive medical attention on a sore wrist and cut elbow.
But it was two back-to-back crashes inside the final 25 kilometres which dictated the tone for a nervous conclusion to what had otherwise been a rather sedate stage.
Five riders went down heavily in the initial spill involving, most notably, Australian Michael Rogers (Team Sky) and Spaniard Luis Leon Sanchez (Rabobank).
A bigger pile-up moments later looked to have been caused by an eager spectator leaning out to take photos. Riders caught up in the ensuing melee included Spaniard Alejandro Valverde (Movistar) and British hope Chris Froome (Team Sky), who punctured five kilometres from the finish.
Froome would be one of the big losers of the day after coming home one minute and twenty-five seconds down on stage winner Sagan. Sanchez fared worse: the three-time Tour stage winner crossed the line 4:05 off the pace and sees his GC hopes go up in smoke.
The Belgian Lotto-Belisol squad set a fierce pace as the streamlined peloton entered the outskirts of Seraing, having swept up the break inside the final 10km. But it was the Orica-GreenEdge squad of Matt Goss who led the pack onto the start of the final climb of the day, the Cote de Seraing.
GreenEdge appeared to be working for the in-form Michael Albasini, who countered an early attack on the steepest part of the ascent by France's Sylvain Chavanel (Omega Pharma-Quick Step).
Cancellara powered his way to the front to lead the chase before putting in a dig that only Sagan could match. The pair rode off the front with Norway's Boasson Hagen in pursuit.
Boasson Hagen, two time winner in 2011, caught the leaders as the road flattened out. The trio slowed inside the final 500m before Sagan – who had been sitting in the wheel of the yellow jersey much to Cancellara's chagrin – lay down the hammer with an explosion of pace.
Sagan, known as The Terminator by his team-mates, was so strong that the win looked a routine occurrence - as opposed to his first ever in the world's biggest cycling race.
"Of course people told me I was the favourite," said Sagan, the youngest rider since Lance Armstrong in 1993 to win a stage on the Tour. "I knew that Chavanel would try something at the end. I wanted to attack at the hardest section. It was very, very good that Cancellara was there. I saw that he had strong legs. It was good to take it easy behind him."
Sagan's debut Tour seemed to get off to an inauspicious start after the former mountain biker narrowly avoided crashing during the opening 6.4km prologue in Liege a day earlier.
But the latest win in an illustrious career will cement Sagan's position as favourite for the green jersey points competition. He trails Cancellara in the points standings but will start stage two in green by virtue of the Swiss's overall lead.
Belgium's Philippe Gilbert (BMC) took fourth place as the peloton crossed the line in the same time as the leaders, with Bauke Mollema (Rabobank) in fifth and Valverde sixth.
World champion Mark Cavendish could not keep in touch with the leaders on the final climb, the Team Sky sprinter coming home just over two minutes in arrears.
Cavendish will look to open his 2012 Tour account in Monday's flat 207.5km stage from Vise to Tournai, which looks likely to end in a bunch sprint.
- Related links