Aru lost touch with the leaders in the final short, sharp ascent of the Cote de Saint Pierre in the town of Rodez and crossed the line 25 seconds behind Matthews.
It was unclear whether the Italian suffered a mechanical problem in the closing stages, or made a mistake by riding at the back.
Froome, who trailed Aru by six seconds at the start of the stage in Blagnac, was well positioned at the front and had no problem tackling the final climb. He finished hot on the heels of Matthews.
While the Team Sky train hit the front in the final kilometres, Aru was at the back and didn’t attack before the peloton split in the climb.
“It’s a beautiful surprise today,” Froome said. He lost his jersey in the Pyrenees after enduring a bad day on the road to Peyragudes.
“I need to say thank you to my team-mates who rode at the front in the final 10 kilometers,” he said. “In the final climb we made a big difference on other favorites. Every second counts at this Tour.”
Froome now enjoys an 18-second advantage over Aru, who is paying for the weakness of his Astana team, which lost key member Jakon Fuglsang on Friday after he broke a wrist and elbow.
French rider Romain Bardet is 23 seconds back from the leader, in third place. In fourth is Rigoberto Uran, who trails the Froome by 29 seconds overall.
Froome could hardly believe he won back so much time and recovered the yellow jersey on a stage that, on paper, didn’t seem set up to pose such difficulties for Aru.
Froome said his team-mates played an essential role in keeping him at the front, allowing him to pounce on the final climb while Aru was stuck. In the last frenzied dash, Froome said team-mate Michal Kwiatowski was urging him on over their radio system, yelling: “Froomey, go, go, go! There are gaps everywhere!”
Froome said that he’d always expected this Tour to be very open, with its atypical route over all five of France’s mountain ranges, a prediction that is coming true, with 29 seconds separating the top four.
“Everyone is fighting for every second,” Froome said. “The time I made up today could be very vital.”
Matthews, who beat Olympic champion Greg Van Avermaet in the sprint to claim his second stage win at the Tour, said he’d targeted the stage win all year, and trained specifically for the last climb.
“I’ve been dreaming of winning like that since I started cycling,” he said. “I could sit up and enjoy the win in the Tour de France.”
Well before the frenetic finale, veteran French rider Thomas Voeckler launched hostilities on the outskirts of Toulouse.
Voeckler was joined at the front by four other riders who took advantage of the peloton’s apathy.
The pack, however, kept the quintet on a leash as they rolled through the Aveyron province, keeping its deficit under two and a half minutes.
With less than 100km left, the peloton passed Carmaux. But there was no sign of insurrection within the pack, with the Sunweb, Bahrain, and BMC teams riding at the front at a pedestrian pace. But when the road began to climb, the leading group struggled to stay together. Thomas De Gendt went solo with 36.5 kilometers left but the Lotto rider lacked stamina and could not resist the peloton’s chase on roads with constant ups and downs.