Perfectly positioned at the front of a peloton that battled wind and echelons all day, Sagan and team-mate Maciej Bodnar attacked in the final 12km to cause one last split in the 162.5km stage from Marcassone to Montpellier.
Digging deep, Froome and team-mate Geraint Thomas were able to follow the Tinkoff riders. Despite the pain of the collaborative effort visibly evident, the foursome's lead never grew much past 20 seconds.
As Froome crossed the finish behind Sagan, he was just six seconds ahead of his nearest rivals. But after his six bonus seconds were awarded, Froome gained a total of 12 seconds over his rivals.
Sagan couldn't quite believe he was in a breakaway with the yellow jersey.
“Yellow jersey and green jersey at the front, it's unbelievable," he said. "When we rode away with Froomey and Geraint Thomas, we had no breath to talk. All we could say was, ‘Go, go, go.' We started to go, then we worked together.
"It was a crazy day with wind and crashes. I don't know if it's my best victory at the Tour de France but for sure it's a special one. I'm very happy with the way I won this one with the help of Maciej Bodnar and Team Sky."
"I would have liked to let Bodnar win the stage but Froome wanted to take a maximum of seconds so I had to go for the stage win because that's what we had worked for. Today we're not actors, we're artists!
Froome acknowledged the efforts of his team-mates on a challenging day and had an answer for those asking if his efforts were worth it.
"Today, the guys positioned me to perfection, that's how I could go after Sagan.
“I was asking myself in the last ten kilometers: is it worth it? At the moment, I try to get time on my adversaries anywhere, knowing that Nairo [Quintana] is usually very strong in the last week. So whenever I manage to take seconds on him, I will.
"I'm just enjoying my racing. To be in the yellow jersey is a dream scenario. It's bike racing at its best. I attack downhill and on the flat just because I enjoy it, I'm not forced to it because of the pressure."
Ideally positioned for most of the stage, a moment's inattention saw Quintana (Movistar) isolated and halfway back in the pack when Froome attacked. After the split, there appeared to be no sense of urgency from the Colombian as he waited for his team to rejoin him. But he was able to follow the efforts of the sprinter's teams and limit his losses.
Mark Cavendish (Dimension Data) suffered a puncture in the remaining kilometres and was unable to contest the rest of the bunch sprint, which may have kept Cavendish in the hunt for the green jersey.
As it happened
With the wind at the peloton's back from the start in Carcassonne, splits occurred almost instantly as riders slipped off the front. While Sky settled the bunch down a little, Arthur Vichot (FDJ) finally managed to gap the peloton by the third kilometre, Australian Leigh Howard (IAM Cycling) closely on his wheel.
In the nervous peloton, crashes occurred early on, one involving George Bennett (LottoNL-Jumbo) and Thibault Pinot (FDJ).
By the 57th kilometre on the Cote de Villespassans climb, the duo had built a lead of three minutes and 29 seconds where Howard happily allowed Vichot to take the one KOM point available to go with the other he took on the Cote de Minerve at the 38th kilometre. The pair were caught with 61km left to race.
Cracks in the peloton first appeared with 91kms to go after Matteo Tosatto (Tinkoff) attacked for Sagan and instantly the peloton snaked behind single file, fifty to sixty riders off the back.
While riders were able to rejoin when the road changed direction back into the tail wind, this pattern re-occurred several times along the road and at one point the peloton was split into five groups. But proceedings calmed with around 40km to go.