Froome had kept at the front of the bunch on a speedy downhill section over the final 10km before finding himself ideally placed to attack the 600-metres uphill finale. And it proved to be a great day as he took back the yellow jersey from
Italian Fabio Aru.
"It's good to be back (in yellow) and really unexpected. It's such an amazing feeling after a tough day in the Pyrenees (on Thursday) to get it back," said Froome, the reigning champion.
"It definitely was not the plan to lose the jersey and I definitely didn't expect to be back in the yellow jersey after today's stage.
"I knew the final would be selective but I didn't expect to be taking these time margins from my rivals."
Froome finished seventh, one second behind Matthews but four seconds ahead of Romain Bardet and Simon Yates, 21 seconds ahead of Nairo Quintana and 24 seconds clear of Aru.
Only Dan Martin and Rigoberto Uran of the top 10 finished alongside Froome, in eighth and ninth respectively. Froome now leads Aru by 18 seconds, the exact same lead he'd enjoyed over the Italian before cracking on the brutally steep uphill finish to Thursday's Pyrenean mountain stage when he finished 22 seconds behind stage winner Bardet.
"I am absolutely shocked to see the same kind of time gaps today as we saw in the Pyrenees on that stage when I had a tough day," added the three-time Tour winner.
"I just didn't have the legs on that day. I'd like to think I've bounced back and recovered. After two consecutive hard days, that's where it brings out the stage racer in people and just exactly where everyone's at."
The top 10 are still bunched closer together than they were before the Pyrenees despite Froome's gains, with Bardet third at 23sec, Uran fourth at 29sec, Spaniard Mikel Landa fifth at 1:17, and Martin sixth at 1:26.
Since Froome previously held the yellow jersey, both Bardet and Uran have closed in by almost 30sec while Martin has gained just over 20sec.
Landa has taken back even more time but is Froome's Sky team-mate and riding for his leader rather than his own ambitions.
Froome's gains were all down to experience and good positioning in the final hectic kilometres. And he said that was down to his team.
"Thanks to my team-mates for staying at the front in the end," said Froome.
"Michal Kwiatkowski did great work at the end there and I have to thank him for retaking the jersey."
Aru was caught out near the back of the reduced peloton in that period and couldn't make his way through the bunch, meaning he started the final climb too far back.
His Astana sports director Dmitry Fofonov said he'd paid for his efforts over the previous two days in claiming and then defending the yellow jersey in the high mountains, and for the weakness of his team in comparison to Froome's.
"On a stage like this you don't expect to lose time," said Fofonov. "He paid for his efforts yesterday when he was on his own covering attacks."
'It came true'
Earlier in the day a five-man breakaway went clear but splintered on the undulating 181.5km course from Blagnac to Rodez.
Only Belgian Thomas De Gendt remained with 30km left but he was caught by the peloton 12.5km from the end. Dutchman Maurits Lammertink then had a dig on his own but couldn't make it stick either.
When it came to the sprint, Belgian former world champion Philippe Gilbert led the way but he was overtaken by Olympic champion Greg Van Avermaet and then Matthews.
The Australian comfortably won ahead of Belgian Van Avermaet with Norway's Edvald Boasson Hagen third.
"I targeted this stage from the beginning of the year, I've been gearing my efforts around that finish and it came true," said Matthews.