The son of Ireland's only Tour de France winner, Stephen Roche, ended up third behind eighth stage winner Leopold Koenig of the Czech Republic and Spain's Dani Moreno on the 14-km Alto de Penas Blancas summit finish.
The Saxo-Tinkoff rider now leads overall by 17 seconds from American Chris Horner. Moreno is third while Italian Nibali, 16th in the 158.6-km leg from Jerez de la Frontera, occupies fourth position.
"I benefited from a bit of an opening when things stalled in the main pack behind Koenig," said Roche, Ireland's first leader since Sean Kelly won the race in 1988.
"I was only eight seconds behind Nibali before the stage and I've never led a Grand Tour before so I wanted to go all out and give it absolutely everything," he said.
"Right now I'm the happiest man on earth, it's been an incredible week for me," added Roche who won his first Grand Tour stage on the Vuelta's first summit finish last Sunday and also leads the King of the Mountains competition.
With two summit finishes looming on Sunday and Monday, the 29-year-old was cautious about his prospects of remaining in top spot.
"It would be pretty optimistic to say I can hold this lead all the way to Madrid," said Roche whose best Grand Tour finish is seventh in the 2010 Vuelta.
"Monday is one of the hardest stages of the entire race and if I can get through these three days in the lead that would be great."
Stage winner Koenig's small-scale NetApp Endura team are one of four non-World Tour squads to benefit from an invite to the Vuelta.
"This climb suited me down to the ground, its steeper segments were all in the early part. Once I got through that with the favourites I thought my chances were pretty good," said the Czech.
"I saw [earlier attacker Igor] Anton was suffering and managed to catch him just before the line. I'll try for the overall lead now but anything I get from here on is a bonus for me and the team."
The Vuelta's second straight mountain-top finish on Sunday is a long climb with lung-burstingly steep segments of up to 25 percent in the sierras of northern Andalusia.
The race ends in Madrid on September 15.
1. Leopold Koenig (Czech Republic / NetApp) 4:09:46"
2. Daniel Moreno (Spain / Katusha) +1"
3. Nicolas Roche (Ireland / Saxo - Tinkoff) +5"
4. Thibaut Pinot (France / FDJ.fr)
5. Ivan Basso (Italy / Cannondale)
6. Bart De Clercq (Belgium / Lotto)
7. Igor Anton (Spain / Euskaltel) +13"
8. Alejandro Valverde (Spain / Movistar) +19"
9. Joaquim Rodriguez (Spain / Katusha)
10. Rigoberto Uran (Colombia / Team Sky) +23"
1. Nicolas Roche (Ireland / Saxo - Tinkoff) 31:39:30"
2. Chris Horner (U.S. / RadioShack) +17"
3. Daniel Moreno (Spain / Katusha)
4. Vincenzo Nibali (Italy / Astana) +18"
5. Leopold Koenig (Czech Republic / NetApp) +29"
6. Haimar Zubeldia (Spain / RadioShack) +30"
7. Alejandro Valverde (Spain / Movistar) +31"
8. Rigoberto Uran (Colombia / Team Sky) +42"
9. Rafal Majka (Poland / Saxo - Tinkoff) +52"
10. Joaquim Rodriguez (Spain / Katusha) +1:03"
- Sports & Recreation
- Leopold Koenig
- Stephen Roche
- Chris Horner