Brice Feillu of France burst out of a breakaway group for a solo victory in the punishing stage from Spain into Andorra, the first ride in high mountains in the three-week race this year.
It also marked the first time that the yellow jersey changed hands: Swiss time-trial specialist Fabian Cancellara had held it since winning the opening-day race against the clock in Monaco.
Contador pulled away from Armstrong and a pack of other favourites with a burst of speed in the last two kilometres. The Spaniard, who won the 2007 Tour, finished 3 minutes, 26 seconds after Feillu to sit six seconds behind Nocentini overall.
Tour champion
Armstrong was 3:47 back in the main pack - putting him two seconds behind Astana teammate Contador in the standings. Contador had come into the stage in third, 19 seconds behind Cancellara and Armstrong, who had been separated by a split second.
The seven-time Tour champion appeared to take it in stride.
"Overall, I feel pretty good. I'm not as knackered as I thought I'd be," he said. "Things didn't quite go according to plan that we set up earlier, but it didn't matter. It was a fine day overall."
In the final ascent, Armstrong found himself hugging the wheel of Australia's Cadel Evans, who briefly attacked Armstrong and Contador.
"When you've got a rider away, my obligation is to the team," Armstrong said. "I had to stay on his wheel. You just got to stay on his wheel."
"That's not my speciality, but it's not bad at all - all things considered," he added.
Nocentini and Feillu were part of a nine-man breakaway group that jumped out early in the stage, and the main pre-race favourites were happy to let the escapees go because they aren't considered threats for the overall title.
winner's circle
"It's a nice victory," said Feillu, a 23-year-old riding in his first Tour. He fled the breakaway group about halfway up the final ascent into Arcalis.
"It really makes me happy," said Feillu, an Agritubel rider. Christophe Kern of France was second, five seconds back, while Johannes Froehlinger of Germany was third, 25 seconds behind.
Feillu was hugged in the winner's circle by his older brother Romain, who wore the yellow jersey for a day last year.
"I had confidence in him. I knew it, I knew it, I knew it," said Romain Feillu, with tears in his eyes.
Nocentini, a 31-year-old with the AG2R-La Mondiale team who won a stage in Pasadena in the Tour of California this year, came into the stage trailing Cancellara by 3:13. He became the first Italian to wear the yellow jersey at the Tour since Alberto Elli in 2000.