(CNN) -- Norway's Edvald Boasson Hagen has won the 179km 17th stage of the Tour de France from Gap to Pinerolo in Italy, with Thomas Voeckler hanging onto his race leader's yellow jersey despite veering off the road in a dramatic descent to the finish.
Boasson Hagen, who won the sixth stage of the race as well as narrowly losing out to compatriot Thor Hushovd in Tuesday's 16th stage, attacked his rivals on the final climb of the day -- the Cote de Pramartino -- before extending his advantage on the tricky downhill to the line.
The Team Sky rider, who was part of the day's 14-man breakaway group that formed at 58km, came home 40 seconds clear of Dutchman Bauke Mollema to give Norway their fourth stage victory after Hushovd's triumphs in stage 13 and stage 16.
"I've had a really great Tour and have been able to get in the right breakaways just like Thor has -- the two Norwegians in this race are in really good form," Boasson Hagen told reporters.
However, the real drama was unfolding behind, with defending champion Alberto Contador attacking his rivals for overall victory on the final climb, although all of the main contenders -- apart from Voeckler and Ivan Basso -- managed to catch the Spaniard on the descent to finish in the same time, 4:26 behind Boasson Hagen.
Voeckler and Basso lost 27 seconds, coming home 4:53 behind the winner, but it could have been so much worse for Europcar rider Voeckler, who completely overshot a corner on the final descent, ending up in a residential car park on the side of the road.
Despite the mishap, Voeckler takes a 1:18 second lead over Australian Cadel Evans into the two decisive Alpine stages, with Frank Schleck on 1:22 in third place and younger brother Andy in fourth place, 2:26 behind.
Samuel Sanchez remains fifth, 2:59 behind, with Contador -- who is looking stronger and stronger as the race progresses -- sixth on 3:15 and Damiano Cunego seventh on 3:34.
The day's big loser was dual Giro d'Italia winner Basso, who slips to eighth place. However, he is still very much in touch, just 3:49 behind Voeckler, in what is the closest Tour for many years.
The race is expected to be decided in the next two days, with the 169 remaining riders facing a grueling 200.5km trek on Thursday from Pinerolo to the ascent of the giant Galibier.
With two massive climbs prior to the Galibier -- which at 2,645 meters above sea level marks the highest stage finish in the history of the race -- Frenchman Voeckler may finally lose the race lead he has bravely held onto since stage nine.
"I lost time and, if I'd been more calm, I could have finished with the favorites but I was a little bit too ambitious," Voeckler told the official Tour de France website.
"My climbing has been good but I don't think it's going to be good enough for tomorrow. A 6km climb is a lot different to a 35km one," Voeckler added.