Pablo Castrillo triumphs in mountainous Stage 12 of Vuelta
The Spaniard moved ahead towards the end with a stunning attack with 10km left and had already established a half-minute lead over the main chase group with 4km to go.
Castrillo maintained a distance from the group of four behind him throughout the final part of the brutal ascent. In the last hundred meters, realising he would secure his first Grand Tour stage win, he broke into a smile.
"The breakaway was very hard to make. The other guys were very strong. I was nervous for the finale but I decided to attack on the flat and it led me to the stage victory," Castrillo said.
"I thought about attacking with seven or eight kilometres to go but I saw the other guys looking at each other so I went with 10 kilometres."
Britain's Max Poole edged ahead of the chasing group in the final moments to secure second place, while Marc Soler took third, capping a memorable day for Spain.
Australian Ben O'Connor maintained his lead in the general classification, finishing 14th in the stage. He kept Slovenian Primoz Roglic at bay, maintaining a gap of three minutes and 16 seconds.
"It was a tricky start, it was actually really hard. And then we just controlled the race, made some pace on the final climb," O'Connor said.