Fifth on the Alto de Naranco stage behind winner Joaquim Rodriguez of Spain as the front group of favourites split up close to the summit, Horner gained six seconds on ninth-placed Nibali.
With Nibali previously just three seconds ahead and losing time on each mountain stage since Monday, Horner now leads by three seconds and was confident he could widen the gap on Saturday's final mountain stage.
"Tomorrow (Saturday) if the legs are good, I should have the leader's jersey in Madrid," Horner, already the winner of two stages in the 2013 race, told reporters.
"It's a big surprise to have the lead today, I thought I wouldn't get it until maybe tomorrow. Today's climb was hard, but it wasn't really that hard."
Horner said he had let Rodriguez attack in the final kilometre because he was more interested in shadowing Nibali and Spain's Alejandro Valverde, third overall.
"It was all about tactics," said the 41-year-old American, who took the Vuelta lead for the first time on stage three to become the oldest leader of a Grand Tour since 37-year-old Andrea Noe in the 2007 Giro.
Asked if he was worried about forecasts of rain on Saturday, the race's hardest climb to the Alto del Angliru, Horner said "I prefer heat to rain because of my age. But if it is raining I'll just wear more clothes.
"I've not gone up there before, but I'm not so worried when it's steep like the Angliru, I'll watch a replay on TV tonight and work out what's best to do."
Rodriguez left his final attack on the Naranco until there was less than a kilometre to go, and said that after an uneven start to the Vuelta it was the stage win not the time gap that mattered the most.
"With a climb as hard as the Angliru tomorrow, today was my last real chance," said the 34-year-old Spaniard, lying fourth overall. "I knew that with a kilometre to go, it was the hardest part of the climb, so I had to make a gap there."
Asked if he could still win the Vuelta, the Katusha rider answered defiantly, "Why not? Tne Angliru is a climb where the differences will be measured by much bigger gaps than the few seconds I pulled back today."
"I'm at less than two minutes on Horner and when I had more of a disadvantage on the race leader in the Tour, I still didn't give up and I got third. Why not still keep dreaming?"
The Vuelta finishes on September 15 in Madrid.
Results from Vuelta a Espana (San Vicente de la Barquera - Alto del Naranco, 181 km) on Friday
1. Joaquim Rodriguez (Spain / Katusha) 4:16:13"
2. Diego Ulissi (Italy / Lampre) +11"
3. Daniel Moreno (Spain / Katusha)
4. Samuel Sanchez (Spain / Euskaltel)
5. Chris Horner (U.S. / RadioShack) +14"
6. Alejandro Valverde (Spain / Movistar)
7. Michele Scarponi (Italy / Lampre) +16"
8. Leopold Koenig (Czech Republic / NetApp) +20"
9. Vincenzo Nibali (Italy / Astana)
10. Nicolas Roche (Ireland / Saxo - Tinkoff) +23"
Classification from Vuelta a Espana after Stage 19 on Friday
1. Chris Horner (U.S. / RadioShack) 77:56:05"
2. Vincenzo Nibali (Italy / Astana) +3"
3. Alejandro Valverde (Spain / Movistar) +1:06"
4. Joaquim Rodriguez (Spain / Katusha) +1:57"
5. Nicolas Roche (Ireland / Saxo - Tinkoff) +3:49"
6. Domenico Pozzovivo (Italy / AG2R) +6:00"
7. Leopold Koenig (Czech Republic / NetApp) +6:38"
8. Thibaut Pinot (France / FDJ.fr) +7:02"
9. Samuel Sanchez (Spain / Euskaltel) +7:45"
10. Daniel Moreno (Spain / Katusha) +11:05
- Sports & Recreation
- Joaquim Rodriguez
- Chris Horner
- Alejandro Valverde
- Vincenzo Nibali