Nibali attacked with under 2 miles left on the steep ascent to Tre Cime di Lavaredo, the three-week race's highest point at an altitude of 7,550 feet.
On the final stages of the climb, the road was surrounded by huge banks of snow.
An Italian with the Astana team, Nibali clocked 5 hours, 27 minutes, 41 seconds over the 131-mile leg, which began in Silandro and passed through Cortina d'Ampezzo.
Nibali also took the red points jersey from Mark Cavendish, but the British sprinter can reclaim it by winning the final stage.
The race ends on flat ground in Brescia on Sunday with a 122-mile stage starting in Riese Pio X.
Nibali earned his second stage victory, having won Thursday's mountain time trial.
The 19th stage Friday was canceled due to snow. The 20th stage was originally supposed to include a few more climbs, but the route was altered due to the adverse weather conditions and snow covering some roads.
Colombian pair Fabio Duarte and Rigoberto Uran finished second and third, 17 and 19 seconds behind, respectively.
Uran moved up from third to second overall, 4:43 behind Nibali. Cadel Evans, the 2011 Tour de France winner, dropped to third, 5:52 back.
Evans finished about 1 1/2 minutes behind Nibali in the stage, which was also characterized by sub-freezing temperatures. Nibali had to have hot tea poured over his hands to relieve the cold after crossing the line, so he could take off his wet gloves without pain.
Along the final climb, Nibali had to push fans away who kept clinging to him.
"I was worried one of them might slip," he said.
More Sports Headlines
An open letter to new M's GM Jerry Dipoto Goff throws 4 TD passes as Cal rallies to beat Cougars 34-28 A's beat Mariners 7-5 in 13 innings 6:32 a.m. Rawls unfazed by chance to be Seahawks’ lead back Juulsen, Skoleski lead Silvertips to 3-1 victory Nats' Scherzer strikes out 17 Mets as he pitches 2nd no-hitter of season Seahawks' Lynch, Mebane to be game-time decisions Monday night No. 12 Clemson holds on to beat No. 6 Notre Dame 24-22
Our new comment system is not supported in IE 7. Please upgrade your browser here.