The peloton returned to action after the race's first rest day with the 116.3-mile ride from Besancon to Oyonnax, not far from the Swiss border. The stage featured four small- to medium-sized hills near the end.
In the stage's mini-drama, American Andrew Talansky, struggling through pain from crashes earlier in the race, dropped out of the pack and rode solo much of the day. In a show of grit, he finished some 32 minutes back — enough to qualify to ride another day under race rules.
Gallopin, who wore the yellow jersey for a day before Nibali recaptured it, first tried to break away with about 8.4 miles left but got reeled in. Then, in a late flurry, with less than two miles to go, the Lotto-Belisol rider tried again. This time, it worked.
He chiseled out a lead of several seconds and, desperately pedaling, held off a surging pack in the final several hundred yards.
Gallopin won by several bike lengths, just enough for him to have time to lift his arms in celebration, panting.
"Incredible," said Gallopin of his first Tour stage win. "I came to train for the Tour de France here … that really served me today.
"It's really a victory that feels good."
The top standings didn't change, because Nibali finished in the pack with the same time as Gallopin. Astana team leader Nibali has a lead of 2 minutes 23 seconds over second placer Richie Porte of Australia. Alejandro Valverde of Spain iss third, another 24 seconds back. Gallopin is in fifth, 3:12 behind Nibali.
With such a margin and the strong form he has shown so far, Nibali is looking well-positioned for possible victory when the race ends in Paris on July 27. But tough days lie ahead: in the Alps later this week, and the Pyrenees mountains in Week Three.
Talansky, in pain after two crashes twice in recent days, dropped back from the peloton more than halfway through the stage. At one point, he stopped and sat down on a roadside guard rail. French TV first counted him out, as did some observers on Twitter.
But in a show of heart, and with encouragement from his team sports director Robert Hunter, Talansky got back on his bike, wiped his eyes and continued. Now he was racing against the clock. Under race rules, which require riders to finish within a certain time of the stage winner, he had to finish within 37 minutes of Gallopin.
Talansky did that with about five minutes to spare, said Jean-Francois Pescheux, a top race official.
The Garmin-Sharp team leader, who won the Criterium du Dauphine stage race last month, was seen as a potential podium contender before this Tour. But Talansky fell largely out of contention for that prospect in Stage 10, when he had the second of two crashes in this race.
As Wednesday's stage began, he was nearly 15 minutes back of Nibali in 26th place.
Riders head off on another day featuring four small- to mid-sized climbs on Thursday, with a 115-mile 12th stage from Bourg-en-Bresse to Saint-Etienne.