Velits took the 46-kilometer race against the clock around Penafiel in 52 minutes, 43 seconds to edge defending Vuelta champion Denis Menchov of Russia by 12 seconds.
Nibali was 1:54 behind to reclaim the leader's red jersey a day after losing it to Rodriguez, who was 6:12 off the pace in 105th.
Nibali, of the Liquigas-Doimo team, leads after 17 stages with a time of 71:19:49. Spanish rider Ezequiel Mosquera is the Italian's closest rival, 39 seconds back.
Rodriguez dropped 3:45 behind ahead of Thursday's 148.9-kilometer leg.
The 21-stage race wraps on Sunday.
Results from the 17th stage:
1. Peter Velits, Slovakia, HTC-Columbia, 52 minutes, 43 seconds.
2. Denis Menchov, Russia, Rabobank, 12 seconds behind.
3. Fabian Cancellara, Switzerland, Saxo Bank, :37.
4. Gustav Larsson, Sweden, Sax Bank, :50.
5. Luis Leon Sanchez, Spain, Caisse d'Epargne, 1:03.
6. Leif Hoste, Belgium, Pharma-Lotto, 1:07.
7. David Zabriskie, United States, Garmin-Slipstream, 1:10.
8. Carlos Barredo, Spain, QuickStep, 1:14.
9. Philippe Gilbert, Belgium, Pharma-Lotto, 1:24.
10. David Millar, Britain, Garmin-Slipstream, 1:27.
Overall Standings
1. Vincenzo Nibali, Italy, Liquigas-Doimo, 71 hours, 19 minutes, 49 seconds.
2. Ezequiel Mosquera, Spain, Xacobeo Galicia, 39 seconds behind.
3. Peter Velits, Slovakia, HTC-Columbia, 2:00.
4. Frank Schleck, Luxembourg, Team Saxo Bank, 3:44.
5. Joaquin Rodriguez, Spain, Team Katusha, 3:45.
6. Xavier Tondo, Spain, Cervelo, same time.
7. Thomas Danielson, United States, Garmin-Slipstream, 3:55.
8. Nicholas Roche, Ireland, AG2R La Mondiale, 4:03.
9. Carlos Sastre, Spain, Cervelo, same time.
10. Luis Leon Sanchez, Spain, Caisse d'Epargne, 5:43.