(CNN) -- Samuel Sanchez finally won his first stage at the Tour de France on Thursday, but the title hopes of his fellow Spanish cyclist Alberto Contador suffered a surprise blow as the race headed into the mountains.
Sanchez was fourth in the sport's biggest event last year, but found himself more than five minutes behind leader Thomas Voeckler going into the 12th leg from Cugnaux to Luz Ardiden.
However, the 2008 Olympic road race champion sped clear of the bunch of escaped riders going into the final ascent along with Jelle Vanendert, and the 33-year-old held off the Belgian for a memorable victory by seven seconds in the Pyrenees.
It came almost 10 years after his Basque-based Euskaltel team's first stage win at Le Tour, also at Luz Ardiden.
"I knew it was an important day, and I had to try something because I was late to my position in the general classification meant that I was not a dangerous rival for some of the GC riders," Sanchez told the race website.
"I had my chance and I decided to go. I was also aware that Andy Schleck had lost a lot of teammates and so did Alberto Contador, so they were not able to reel in our escape."
Sanchez came in 50 seconds ahead of Voeckler, who retained the yellow jersey after placing ninth.
Defending Contador, seeking a fourth title, was eighth as he lost time on his main rivals to be four minutes adrift overall with nine stages left.
"I had a really sore knee, it was bothering me so I'm happy with the result even if I did concede a few seconds. I couldn't do any better," he said.
"I've been feeling the effects of those crashes in the first week, my pedal stroke hasn't been great. But I'm sure things are going to improve. The engine is taking some time to warm up but I think everyone is feeling tired and I hope that will play to my advantage."
Voeckler kept his lead of one minute and 49 seconds, though Luxembourg's Frank Schleck moved up to second place as he finished third -- 10 seconds behind Sanchez.
Two-time runner-up Cadel Evans of Australia was 30 seconds behind the winner in fifth to be third overall, 2:06 behind Voeckler.
Andy Schleck, who lost out to Contador last year after a controversial chain-break incident, was left 2:17 adrift after finishing sixth in the same time as Evans and Italy's Ivan Basso, who was fifth overall with a deficit of 3:16.
Voeckler was happy after keeping pace with the stage leaders until 1,800 meters from the end.
"I was a little bit afraid when I crashed at the top of the first climb. I'm normally not so bad in the downhill but I was very scared this time. The road was very slippery and I decided to change my bike and that helped," said the Frenchman, who has held the maillot jaune since finishing second in stage nine.
"On the final climb, I was still in the race along with the best climbers. I told myself, 'Keep going! Keep going!' And Pierre Rolland gave me a great hand in the final -- he really helped me. My legs felt good but it was the great job done by the Europcar team that really helped me today."
Thursday's stage winner Mark Cavendish was more than half an hour off the pace in 153rd, but retained the sprinters' green jersey as he extended his lead to 18 points from Spain's Jose Joaquin Rojas.
Sanchez won the climbers' polka-dot jersey for King of the Mountains, while the Schlecks' Leopard-Trek lead the teams.
Friday's 13th stage is a 152.5-kilometer route from Pau to Lourdes, featuring a steep climb up the 1,709-meter Col d'Aubisque.