Create a free account to unlock this article!
Already a subscriber? Log In
Colombia's Nairo Quintana and Frenchman Romain Bardet also fell further behind Roglic. Martinez came under extreme pressure for the stage win from fellow breakaway riders Maximilian Schachmann and Lennard Kamna as the Bora pair broke for the winning line at 1,589m of altitude and looked set to win.
Gritting his teeth and pouring with sweat, the Colombian however dug deep for a final kick that carried him to a last-gasp win.
"I managed to hold on and win with a late sprint," said Martinez, who formed a heart with his fingers on the finish line.
Martinez won the key Tour de France warm-up, the Criterium du Dauphine, in August and also a stage on Paris-Nice.
"I did well on those races, but winning a stage on the Tour is on another level," said the 24-year-old.
Further down the hill as the race hit a nine-percent incline on the day's sixth and final climb, Roglic and Pogacar managed to shake off an elite clique of riders in contention to win this Tour.
Slovenia vs Colombia
Roglic now enjoys a 44sec lead over 21-year-old Pogacar, who climbed to second, while Bernal dropped to third, 59sec off the yellow jersey.
"It was a Slovenian day, there's two of us ahead of a few Colombians," Roglic said. "There are great professionals in Slovenia in all kinds of sports, it's a tough nation and we are all pushing each other.
"Looking at it from distance this Tour is not finished and (Bernal) is not finished, but I don't want to bother myself worrying about other people," Roglic said.
"When i saw that final climb I thought 'pfffft, this is going to hurt'. So I'm happy it all went my way."
Defending champion Bernal now looks under severe pressure from Roglic, who has a powerful climb team around him. The director of Bernal's Ineos team, Benjamin Rasch, said the 23-year-old was improving each day from a bad back and that Friday's stage did not suit his leader.
"We will do better on the really tough stages," Rasch said. "Of course he wants to win the tour," Rasch said "He's a good leader and a good lad."
Pogacar, two years younger than Bernal, also reclaimed the best under-25s white jersey thanks to his Puy Mary climb.
"I gained time on everyone except Roglic on the last hill and yes we are both Slovenians but we were not friends over those final kilometres," said Pogacar, of the UAE team.
The holder of the green jersey, Irishman Sam Bennett, and the vastly experienced Peter Sagan will likely renew their struggle for sprint points on Saturday's 194-kilometre run over five small hills between Clermont-Ferrand and Lyon.