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
Snohomish mixed martial artist returns to her first love Mariners beat Twins 4-3 in 11 innings Charles scores 29 points, Liberty beat Storm 78-62 Park wins Women's British Open, captures 4th different major Perry wins 2nd straight Champions Tour's 3M Championship Merritt shoots 67 to win Quicken Loans National by 3 shots Triple Crown winner American Pharoah wins $1.75 million Haskell Invitational Bills' Ryan names Incognito starting left guard
Our new comment system is not supported in IE 7. Please upgrade your browser here.