Santambrogio, who rides for Vini Fantini, won in a time of 4 hours, 42 minutes, 55 seconds in in rainy, windy and even snowy conditions, beating Nibali in a final sprint at the top of the steep Jafferau climb. Carlos Betancur was third.
"It still hasn't sunk in," Santambrogio said. "I set off at the end, in the snow. My team was magnificent today. I found myself in front with Nibali with about 3 kilometres to go, Vincenzo attacked and I responded, because I felt good."
The stage had to be altered shortly before the start and the climb up Sestriere was removed because of avalanche threats. The cyclists were re-routed through Val di Susa, on a longer 180-kilometre (112-mile) course from Cervere to Bardonecchia.
Sunday's route, which crosses into France and includes climbs up the Galibier and the Col du Mont Cenis, is also likely to be altered.
Nibali, who finished third and second in his last two Giro races, extended his lead to 1:26 over Cadel Evans and is firmly on course to win his home country's biggest cycling race for the first time.
"It was a very difficult stage," Nibali said. "There was just rain the whole way, apart from at the end, when we were hit by sleet. The road is still long. I did well today. Santambrogio won after managing to stay on my wheels."
Santambrogio moved up to fourth, 2:47 behind Nibali and just a second behind third-place Rigoberto Uran.
Sonny Colbrelli, Luca Paolini, Matteo Trentin and Daniele Pietropolli led for most of the leg, building a lead of more than nine minutes, but the peloton started to reel in the four escapees with 40 kilometres (25 miles) left. Trentin and then Pietropolli fell back from the lead group shortly before the start of the grueling category-one climb to the finish, which had a gradient of 14 per cent in some places.
Nibali made his move inside the final 2 kilometres, (1.5 miles), emerging from the fog near the finish line with Santambrogio. And Santambrogio clung on, holding off the race favourite to claim his first Grand Tour stage victory.
The Giro ends May 26 in Brescia.