On the big, final climb of Stage 18, the Italian broke out of the peloton, chased down breakaway riders, and rode solo in front for the last five miles uphill.
Nibali, who captured his fourth stage of the Tour, stuck out his tongue, tapped his chest, and raised a fist skyward as he finished the 90-mile leg more than a minute ahead of Thibaut Pinot of France, who was second. Rafal Majka of Poland, in third, was another two seconds back.
The remarkable effort by Nibali, set to become the first Italian to win the Tour since Marco Pantani in 1998, essentially reduced the race drama to who will join him on the podium on the Champs-Elysees on Sunday.
"I didn't want to lose command. My goal was to win here," Nibali said. "It was important to me to win another stage in the Pyrenees. The team worked really hard and this victory is for them."
He is also set to become only the sixth rider to win all three Grand Tours of France, Italy and Spain. He won the 2013 Italian Giro and the 2010 Spanish Vuelta.
One man basking at the finish line was Alexandre Vinokourov, the general manager of Nibali's Astana team, and a former rider who was expelled from the 2007 Tour for blood doping. He said the stage victory was "not by chance."
"We said, `we need to show that there's a boss,"' Vinokourov told French TV. The last time the term "boss" was used regularly at the Tour was when a doped-up Lance Armstrong won seven in a row.
While three stages are left, Friday's is mostly flat and unlikely to allow a breakaway rider to gain time. The last real challenge will be Saturday's individual time trial, but Nibali's lead is so big -- 7 minutes and 10 seconds ahead of Pinot, and 7:23 ahead of France's Jean-Christophe Peraud -- that it would take a disaster for him to lose the yellow jersey before Sunday.
"It was a very good day," said Pinot, who rose a spot from third, "but Nibali is untouchable."
The race for second heated up: Alejandro Valverde of Spain lost crucial seconds on the last climb and fell from second overall to fourth, two seconds slower than Peraud. But Valverde is considered a stronger time-trial rider than Pinot, and possibly Peraud.
"Everything is possible," Valverde said. "Before, I was ahead, now I'm behind, but it's very tight. I'm pretty happy."
After setting off from Pau, riders tackled the famed Tourmalet pass -- the highest Pyrenean peak on this Tour -- before heading up to Hautacam ski station. Both climbs are among the toughest in professional cycling.
Two breakaway riders, Mikel Nieve of Spain and Blel Kadri, a Frenchman who won Stage 8, were the first over Tourmalet more than 4 1/2 minutes ahead. But by the valley below, the duo had lost two minutes: Nibali's chasing bunch was gaining.
That was partly because Valverde's Movistar squad bolted ahead in a challenge to Nibali. The Italian didn't let that last long, and Valverde was caught within a few minutes. By the foot of Hautacam, the main contenders were bunched together.
Then, American Chris Horner, who beat second-place Nibali in the Vuelta last year, broke away. Nibali stayed with him, and then, rounding a curve and looking back for the peloton, burst ahead. Nibali said later he had memories of Horner's Vuelta victory in mind. That said, Horner was little threat for the Tour title: He was about 35 minutes behind when the stage began.
On the way up, Nibali's shoulder whacked the outstretched elbow of a woman speaking on a mobile phone on the side of road, with her back to the peloton. He winced briefly.
"Happily, it wasn't serious for her or me," Nibali said.
Stage 19 on Friday in southwestern France will likely end in a sprint finish, and Nibali and his Astana teammates will keep a close watch on the riders closest to him in the general classification.