Nieve celebrated his 34th birthday in style by winning the 214km stage from Susa to Cervinia after an attack with 30km to go.
He finished 2min 17sec clear of LottoNL-Jumbo's Robert Gesink while Felix Grossschartner (BORA-hansgrohe) was third. The trio were all the early break.
“It has been a perfect day today, just the way I dreamed it and I am really happy for myself and for the team," Nieve said. "After yesterday, it was important to bounce back and now we have to be happy with what we have achieved at the Giro."
“With five stage wins and so many days in the Maglia Rosa it has been a great Giro d’Italia for us and we have to enjoy the final day tomorrow now.
“I won my first stage at the Giro in 2011 and now after seven years, to win again is really important for me, to show I am still with the best riders, and also for the team and I am really happy.”
Barring a final stage calamity Chris Froome (Sky) will celebrate victory and add the one Grand Tour missing from his collection, joining cycling icons Eddy Merckx and Bernard Hinault as one of only three riders to win all three Grand Tours in succession.
"Just incredible feelings, quite emotional," Froome said, who crashed even before turning a wheel in anger in the first stage in Israel and was off the pace for the first week.
Until Friday he was still more than three minutes adrift of long-time leader Simon Yates but in the space of 24 hours, he has taken an iron-fisted grip on the race.
"It has been such a brutal race but I have to say, it has been a beautiful, beautiful event," he said. "There were attacks I had to follow in the final, but I felt in control and capable of following today. Everyone had such a hard day yesterday no one really had the legs to go anywhere."
While Nieve was taking the Stage 20 victory, the ongoing battle for the general classification action was unfolding back down the road.
Froome, who began the day 40 seconds ahead of Tom Dumoulin (Sunweb) after Friday's heroic 80km solo attack, looked fresh and spent the day keeping a careful eye on the defending champion.
When the inevitable attacks came Froome had all the answers and never looked like leaking any of his advantage, crossing the line in seventh and being congratulated by his team.
Dumoulin tried everything he could but reflected on the difficulty of the stage.
"This has been the toughest stage so far, I'm happy with my second place. I did everything right...I'm not the best climber," he said.
Thibaut Pinot (Groupama-FDJ), who was third overall at the start of the stage, saw his chances of a podium finish collapse at the second climb up Col de St-Pantaleon when he almost came to a standstill, clearly suffering from the three-week ordeal.
Astana's Miguel Angel Lopez was the beneficiary of Pinot's misfortune and moved up to third overall.