Part of an 18-rider breakaway group, Nieve caught and dropped Italy's Stefano Garzelli six kilometers from the summit finish in Gardeccia Val di Fassa.
Garzelli took second on the stage around one minute 41 seconds back with Contador third and Michele Scarponi fourth.
With a week to go Contador has widened his lead to four minutes 20 seconds over Italian Scarponi with another Italian, Vincenzo Nibali, trailing five minutes back in third.
Riding through heavy rain showers in the Dolomites, Contador went clear of his closest rivals shortly after they began scaling the fifth and final major climb of the day.
"This was the hardest grand tour stage of my life, really tough," Contador, the three-times Tour de France winner and 2008 Giro champion told reporters, after crossing the line one minute 51 seconds behind Nieve.
"It was a real test for my head as well as for my legs, and I'm very glad it's the rest day tomorrow." "Looking at what happened today, despite the time differences I would say that Nibali is more dangerous than Scarponi," added Contador who in June faces an appeal against the Spanish cycling federations's decision to clear him of taking the banned substance clenbuterol.
"But the race is far from over, there is still a long way to go to Milan and there are too many hard stages coming up to say that I've won it yet." Scarponi, however, thinks Contador will be hard to stop.
"Contador's so strong, I can't see him losing the race unless he has a really bad day," he told reporters.
"Today's stage suited me a lot better than the other mountain climbs, but even so I couldn't do much against Contador." Following Spaniard Igor Anton's victory on the Monte Zoncolan on Saturday, Nieve's win was the second for the Euskaltel-Euskadi team in as many days.
"My initial Giro objective was to support Igor, but this morning in the team bus I told my team mates I thought today could be a good day for me," Nieve told reporters.
"Once I caught Garzelli, I knew I had to try to go for the win, but it was a really hard final climb.
"The last kilometer was really, really difficult, it came at the end of three hard days of racing in the mountains and went on for ever. To get a win like this in the Giro's toughest stage, though, is like a dream. I never thought I'd reach this kind of level in bike racing." After Monday's rest day, racing resumes on Tuesday with a 12.5 kilometer uphill individual time trial.
