Castelldefels - French youngster Warren Barguil (Argos-Shimano) broke clear in the final kilometre of Friday's 169km ride from Valls to Castelldefels to claim the 13th stage of the Tour of Spain.
The 21-year-old was part of a breakaway group of 10 that controlled the second half of the stage but he made the telling break to seize his first professional stage win ahead of Rinaldo Nocentini (Ag2R) and Bauke Mollema (Belkin).
Race leader Vicenzo Nibali (Astana) finished amongst the peloton 2mins 43secs back along with all the other major contenders in the general classification to maintain his 31 second advantage over Nicholas Roche (Saxo).
Barguil celebrated his victory as he crossed the line by pointing to the sky and he dedicated his maiden win to his recently deceased grandfather.
"I am very happy and especially for my grandfather because he was an inspiration for me."
And victory also completed a huge turnaround in fortunes for Barguil after he suffered a heavy fall in Monday's 10th stage in Granada which saw him lose 25 minutes in the general classification.
"I was very disappointed after my crash because I was 19th in the general classification and I felt I was in very good shape.
"Today though the attack went well and I am delighted to seal this first victory."
After Michele Scarponi (Lampre) had briefly led on his own following the category one climb up the Alto del Rat Penat, the Italian was joined by a group of nine more riders that had broken away from the peloton.
The breakaway group maintained their lead of around three minutes from the peloton for the final 40km of the race.
With the winner certain to come from the leading 10, Jerome Coppel (Cofidis) and Egoi Martinez (Euskaltel-Euskadi) were first to attack but were quickly caught before a tactical period followed with no one wanting to take the lead.
However, eventually it was the inexperienced Barguil who made the decisive attack for the line as he held on comfortably in the 400-metre climb to the finish.
Nibali, Roche, Alejandro Valverde (Movistar), Chris Horner (RadioShack) and Joaquim Rodriguez (Katusha) all registered the same time back in the peloton to ensure there was no change in the top five in the general classification.
However, Nibali is expecting more of a challenge from Rodriguez on Saturday as the race heads into Andorra with a series of daunting climbs in the final 100km.
"Tomorrow is a different story. I think that Rodriguez could attack and he has proven today that he is in good condition.
"There are a lot of kilometres until the end of the race. I know the finish tomorrow a little bit and we'll see what happens."
Stage 13 results:
1. Warren Barguil (France / Argos) 4:00:13"
2. Rinaldo Nocentini (Italy / AG2R) +7"
3. Bauke Mollema (Netherlands / Belkin)
4. Ivan Santaromita (Italy / BMC Racing)
5. Xabier Zandio (Spain / Team Sky)
6. Amets Txurruka (Spain / Caja Rural)
7. Michele Scarponi (Italy / Lampre)
8. Egoi Martinez (Spain / Euskaltel)
9. Jerome Coppel (France / Cofidis) +24"
10. Benat Intxausti (Spain / Movistar) +2:34"
11. Diego Ulissi (Italy / Lampre) +2:43"
12. Philippe Gilbert (Belgium / BMC Racing)
13. Dennis Vanendert (Belgium / Lotto)
14. Alejandro Valverde (Spain / Movistar)
15. Daniel Moreno (Spain / Katusha)
16. Ivan Basso (Italy / Cannondale)
17. Nicolas Roche (Ireland / Saxo - Tinkoff)
18. Joaquim Rodriguez (Spain / Katusha)
19. Juan Antonio Flecha (Spain / Vacansoleil)
20. Vincenzo Nibali (Italy / Astana)
1. Vincenzo Nibali (Italy / Astana) 49:29:02"
2. Nicolas Roche (Ireland / Saxo - Tinkoff) +31"
3. Alejandro Valverde (Spain / Movistar) +46"
4. Chris Horner (U.S. / RadioShack)
5. Joaquim Rodriguez (Spain / Katusha) +2:33"
6. Domenico Pozzovivo (Italy / AG2R) +2:44"
7. Ivan Basso (Italy / Cannondale) +2:52"
8. Thibaut Pinot (France / FDJ.fr) +3:35"
9. Rafal Majka (Poland / Saxo - Tinkoff) +3:46"
10. Daniel Moreno (Spain / Katusha) +3:56"
11. Leopold Koenig (Czech Republic / NetApp) +4:08"
12. Tanel Kangert (Estonia / Astana) +5:05"
13. Rigoberto Uran (Colombia / Team Sky) +5:46"
14. Samuel Sanchez (Spain / Euskaltel) +6:38"
15. Eros Capecchi (Italy / Movistar) +6:47"
16. Michele Scarponi (Italy / Lampre) +7:49"
17. Dominik Nerz (Germany / BMC Racing) +8:02"
18. Jose Mendes (Portugal / NetApp) +8:56"
19. Jose Herrada (Spain / Movistar) +9:07"
20. David Arroyo (Spain / Caja Rural) +9:28"