Froome had put in a dominant performance to win the previous day's final time trial and stretch his lead over second-placed Vincenzo Nibali (Bahrain-Merida) to one minute and 58 seconds. However, he saw a large proportion of his gain slashed as he conceded 42 seconds to Nibali on the Alto de los Machucos.
Froome now leads Nibali overall by 1-16, with Wilco Kelderman (Team Sunweb) in third at 2-13.
Stefan Denifl (Aqua Blue Sport) took the stage victory, handing his team a morale-boosting win in their first ever Grand Tour appearance and after suffering the shock of their team bus being severely damaged in an arson attack last week.
Alberto Contador (Trek-Segafredo) came good on his promise to keep attacking by jumping out of the bunch to claim second place on the stage and strengthen his fifth place overall.
How it happened
After a flurry of early attacks, an escape of four riders formed up after 13km into the 180.5km stage: Daniel Moreno (Movistar), Alessandro De Marchi (BMC), Denifl and Magnus Cort Nielsen (Orica-Scott).
They were joined by Davide Villella (Cannondale-Drapac) and stage eight winner Julian Alaphilippe (Quick-Step Floors), as the duo bridged over after 27km.
The six riders swiftly opened up a gap of over seven minutes on the bunch after one hour of racing and continued riding together to increase that lead to nine minutes, and then back down to eight with 100km remaining.
As the six started to tackled the first of the day's three categorised climbs – the second category Portillo de Lunada – they had around four minutes over the peloton.
King of the Mountains Villella crested the top of the Portillo de Lunada to take maximum points, but dropped out of break on the descent inside the final 50km, leaving five riders out front.
By this point the weather had really closed in, with poor visibility, wet roads and fog.
Adam Yates and Esteban Chaves attacked bunch with 23km to go on the penultimate climb of Puerto de Alisas. They created a gap, but were chased down by a group headed up by David De La Cruz (Quick-Step Floors) and Antonio Pedrero (Movistar).
Behind them, five Team Sky riders were leading Froome to close up the gap, with the junction being made with 18.5km to go.
Shortly after, Orica-Scott once again signalled their intention to make a mark on the stage with Jack Haig attacking towards the top of the Puerto de Alisas, joining up with team-mate Cort Nielsen who had dropped back from the break. The two riders created a gap on the twisting descent.
Hitting the bottom of the final ascent of Alto de los Machucos, the break of Moreno, De Marchi, Denifl and Alaphilippe had 1-30 over the peloton and 36 seconds on the chasing duo of Haig and Cort.
The bunch crumbled immediately upon reaching the lower slopes of the climb, with many riders finding the gradient too much to stay in the bunch. The break also fragmented, with Denifl taking the lead.
Miguel Angel Lopez (Astana) was the first of the GC favourites to attack the red jersey group, and he was joined by Alberto Contador (Trek-Segafredo) with 6km to go. At this point, Froome still had four team mates with him as they chased another move by a group including Kruijswijk, Nibali and Kelderman.
In front of them, Contador then attacked Lopez on a steep ramp to go solo and picked his way past all of the former escapees apart from Denifl, who continued his lone escape at the very front of the race.
With his rivals out in front of him, Froome was relying on just Mikel Nieve to try and limit his time loss. Nibali, Ilnur Zakarin (Katusha-Alpecin), Michael Woods (Cannondale-Drapac) and Miguel Angel Lopez (Astana) linked up ahead of Froome inside the final 2km – by which point, Contador was ahead by almost a minute but still out of reach of Denifl.
Denifl swept into the finish to take an emotional victory, with Contador coming home in second at 28 seconds. Lopez claimed third just ahead of Nibali and Zakarin as the clock started ticking down for Froome.
Froome was led into the finish by Nieve, down by over 40 seconds on all of his key GC rivals and having endured perhaps his most challenging moment of the Vuelta so far.
Woods enjoyed one of the biggest gains of the day, jumping up the overall standings from 10th to seventh.
Thursday's stage 18 features another summit finish. The route from Suances to Santo Toribio de Liébana covers 169km and includes four categorised climbs, including the final ascent. Expect Froome's rivals to attack him again – this Vuelta is far from over.
The 2017 Vuelta a España concludes in Madrid on Sunday, September 10.
Vuelta a España 2017, stage 17: Villadiego to Los Machucos, 180.5km
1. Stefan Denifl (Aut) Aqua Blue Sport, in 4-48-52
2. Alberto Contador (Esp) Trek-Segafredo, at 28 secs
3. Miguel Angel Lopez (Col) Astana, at 1-04
4. Vincenzo Nibali (Ita) Bahrain-Merida
5. Ilnur Zakarin (Rus) Katusha-Alpecin
6. Rafal Majka (Pol) Bora-Hansgrohe, at same time
7. Michael Woods (Can) Cannondale-Drapac, at 1-13
8. Daniel Moreno (Esp) Movistar, at 1-17
9. Wilco Kelderman (Ned) Team Sunweb, at 1-19
10. David De La Cruz (Esp) Quick-Step Floors, at 1-42
14. Chris Froome (GBr) Team Sky, at 1-46
General classification after stage 17
1. Chris Froome (GBr) Team Sky, in 67-44-03
2. Vincenzo Nibali (Ita) Bahrain-Merida, at 1-16
3. Wilco Kelderman (Ned) Team Sunweb, at 2-13
4. Ilnur Zakarin (Rus) Katusha-Alpecin, at 2-25
5. Alberto Contador (Esp) Trek-Segafredo, at 3-34
6. Miguel Angel Lopez (Col) Astana, at 4-39
7. Michael Woods (Can) Cannondale-Drapac, at 6-33
8. Wout Poels (Ned) Team Sky, at 6-40
9. Fabio Aru (Ita) Astana, at 6-45
10. David De La Cruz (Esp) Quick-Step Floors, at 10-10
Thank you for reading 10 articles this month* Join now for unlimited access
Enjoy your first month for just £1 / $1 / €1
*Read 5 free articles per month without a subscription
Join now for unlimited access
Try first month for just £1 / $1 / €1