Els Cortals - Tadej Pogacar, the youngest rider in the Vuelta a Espana, ended a day of tense twists on the steep roads of the Pyrenees by taking the ninth stage, as 2016 champion Nairo Quintana seized the overall race lead.
Pogacar, a 20-year-old Slovenian making his Grand Tour debut, was first to the summit of Els Cortals d'Encamp at the end of a short but demanding 99.4 kilometre mountain stage from Andorra la Vella.
The UAE Emirates rider was followed 23 seconds later by Colombian Quintana. Another Slovenian, Primoz Roglic, finished third.
Frenchman Nicolas Edet started the day in the lead but struggled on the big mountains.
Quintana, who rides for Movistar, is six seconds ahead of Roglic of Jumbo-Visma.
Another Colombian, Miguel Angel Lopez of Astana, is third, 17 seconds off the lead. Spaniard Alejandro Valverde, also of Movistar, is fourth, another three seconds back. Pogacar has climbed to fifth, but is 1min 42sec off first place.
"There's still a long way to go," said Quintana after the stage looking ahead to Tuesday's time trial.
"The important thing is to get ahead of Roglic. He still has an advantage knowing the time trial to come", he added.
For a while it looked as if Lopez would take a big lead.
He burst away from the group of favourites with 19km to go. He had built a gap of some 40 seconds and was chasing the riders ahead in the hope of a stage victory when a ferocious storm struck.
As torrential rain turned to hail, the feed from the TV cameras on the route cut out.
When they came back on, and the Movistar pair of Quintana and Alejandro Valverde had caught up.
Lopez had blood on his elbow, suggesting a fall in the wet.
"I entered a curve quickly, because my rivals were about 30 seconds ahead, and I lost the bike," Lopez said after the race.
He struggled home ninth in the stage, more than a minute behind the winner.
As the race approached the finish, another Movistar rider, Marc Soler, was alone in the lead.
He reacted with fury when, with 3.5km to go, the team ordered the Spaniard to wait. With an angry gesture, he slowed down until Quintana had caught up and helped pull the Colombian to the finish and away from the other contenders, including team-mate Valverde.
That gave Pogacar a chance and he seized it.
"I was looking at this stage since the start," he told broadcaster Eurosport after the finish.
"When I saw the weather, I was happy that it would rain because that is good for me.
"Today was tricky stage, lots of technical problems, a hail storm. Today was incredible."
The final kilometres were good for Slovenians. While Pogacar was pulling away, Roglic, who had appeared spent with 15 kilometres to go, was charging through the field for a solid third place.
Monday is a rest day and the racing resumes with a 36.2km time trial from Jurancon to Pau in France on Tuesday.
Vuelta a Espana ninth stage results on Sunday, 94.4km from Andorra la Vella to Els Cortals d'Encamp:
1. Tadej Pogacar (SLO/UAE) 2hr 58min 09sec, 2. Nairo Quintana (COL/MOV) at 23sec, 3. Primoz Roglic (SLO/JUM) 48, 4. Alejandro Valverde (ESP/MOV) 48, 5. Marc Soler (ESP/MOV) 57, 6. Hermann Pernsteiner (AUT/BAH) 59, 7. Sergio Higuita (COL/EF1) 1min 1sec, 8. Wilco Kelderman (NED/SUN) s.t., 9. Miguel Angel Lopez (COL/AST) s.t., 10. Tao Geoghegan Hart (GBR/INE) 1:38.
1. Nairo Quintana (COL/MOV) 35hr 18min 18sec, 2. Primoz Roglic (SLO/JUM) at 6 sec, 3. Miguel Angel Lopez (COL/AST) 17, 4. Alejandro Valverde (ESP/MOV) 20, 5. Tadej Pogacar (SLO/UAE) 1:42, 6. Carl Fredrik Hagen (NOR/LOT) 1:46, 7. Nicolas Edet (FRA/COF) 2:21, 8. Rafal Majka (POL/BOR) 3:22, 9. Wilco Kelderman (NED/SUN) 3:53, 10. Dylan Teuns (BEL/BAH) 4:46.