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
Cedarcrest Golf Course cuts back on watering the course U.S. women have traveled tough road en route to World Cup final Mariners hit 4 home runs in 9-5 win over A's Wesco players help West beat East 21-13 Tri-City routs AquaSox 9-3 Mears' goal leads Sounders to 1-0 victory over D.C. United Moore leads Lynx to 82-57 win over Storm Dempsey, Chandler score as U.S. beats Guatemala 4-0
Our new comment system is not supported in IE 7. Please upgrade your browser here.