Chris Froome is set for a historic Giro d'Italia victory after he held off late attacks from nearest rival Tom Dumoulin on the penultimate stage into Cervinia.
The Team Sky rider, 33, extended his advantage over the Dutchman to 46 seconds with Sunday's final stage in Rome traditionally a procession.
Froome will be the first British man to win the Giro in its 101-year history.
And he will hold all three Grand Tours simultaneously after wins last year at the Tour de France and Vuelta a Espana.
Barring any incident or accident on Sunday, the four-time Tour de France winner will be the seventh man to complete the set of Grand Tours.
Spain's Mikel Nieve won the stage on his 34th birthday, attacking with 32km to go in the mountains to finish two minutes 17 seconds clear of Dutchman Robert Gesink.
Dumoulin provides late drama
It is a remarkable turnaround for Froome, who had barely been in contention a few days ago after an injury-hit first two weeks.
He set up victory with Friday's stunning stage 19 win that saw him jump from fourth to take the pink jersey.
He had a 40-second lead over reigning champion Dumoulin going into stage 20, a 214km ride from Susa to Cervinia in the Alps in northern Italy,
Both riders had been content to sit in the peloton with Froome protected by his team-mates.
But with the pink jersey at stake, Dumoulin made his first attack 6km out on the last of three category one climbs.
Froome responded immediately, going on the attack himself to rein Dumoulin back in.
It became a cat-and-mouse fight between the pair with Froome's legs showing no ill-effects from Friday's heroics.
Dumoulin cracked with 3km remaining as his challenge faded and Froome finished with a sprint, six seconds ahead of his rival to retain the maglia rosa in the shadow of the Matterhorn.
"I felt in control," said Froome, who would join Eddy Merckx and Bernard Hinault in holding all three Grand Tours at the same time.
"Everyone had such a hard day yesterday, no-one had the extra legs to go anywhere."
Praising the support from his team, Froome added: "It was amazing to able to repay them after three weeks of hard work, they believed in me."
Froome garnered support from the crowds lining the route although one fan appeared to spit at him 3km from the finish line.
When asked about that after the race, Froome said he did not see the incident.
It is not clear why the fan may have spat at Froome, but the Briton does have his detractors after showing elevated levels of the asthma drug salbutamol at last year's Vuelta a Espana.
Froome does have a therapeutic use exemption allowing him to take the drug for medical reasons, though the investigation into why his levels were above those allowed in September's race has still to be concluded.
Speaking about the race, Dumoulin said: "I tried everything I could and Froome was a better rider. I was just tired today and wasn't sure I'd have the legs to try, but I would always have regretted it if I hadn't."
France's Thibaut Pinot blew a chance for a place on the podium. Having been in third place at the start of Saturday's stage, he was left behind on the second climb up Col de St-Pantaleon.
Astana's Miguel Angel Lopez took advantage as he took third place overall, four minutes 57 seconds behind Froome.
BBC Radio 5 live's Bespoke podcast pundit Jeremy Whittle
It's a remarkable reversal and an incredible turnaround, perhaps the most extraordinary in Chris Froome's career. It will become a really famous episode in his long story and one of the most remarkable episodes in the history of the Giro - in fact, in the history of all the grand tours of Italy, France and Spain.
I thought he was going to quit at one stage, he looked like he was going backwards fast. But if you look back at the results he's always been there or thereabouts.
Stage 20 result
1. Mikel Nieve (Spa/Mitchelton-Scott) 5hrs 43mins 48secs
2. Robert Gesink (Ned/Lotto) +2mins 17secs
3. Felix Grosschartner (Aut/Bora) +2mins 42secs
4. Giulio Ciccone (Ita/ Bardiani) +3mins 45secs
5. Gianluca Brambilla (Ita/Trek) +5mins 23secs
6. Wout Poels (Ned/Team Sky) +6mins 03secs
7. Chris Froome (GB/Team Sky) +6mins 03secs
8. Davide Formolo (Ita/Bora) +6mins 03secs
9. Domenico Pozzovivo (Ita/Bahrain) +6mins 03secs
10. Richard Carapaz (Ecu/Movistar) +6mins 03secs
13. Tom Dumoulin (Ned/Sunweb) +6mins 09secs
144. Simon Yates (GB/Mitchelton-Scott) +45mins 32secs
1. Chris Froome (GB/Team Sky) 86hrs 11mins 50secs
2. Tom Dumoulin (Ned/Team Sunweb) +46secs
3. Miguel Angel Lopez (Col/Astana Pro Team) +4mins 57secs
4. Richard Carapaz (Ecu/Movistar Team) +5mins 44secs
5. Domenico Pozzovivo (Ita/Bahrain-Merida) +8mins 3secs
6. Pello Bilbao (Spa/Astana Pro Team) +11mins 50secs
7. Patrick Konrad (Aut/Bora-Hansgrohe) +13mins 01secs
8. George Bennett (Nzl/Team Lotto NL-Jumbo) +13mins 17secs
9. Sam Oomen (Ned/Team Sunweb) +14mins 18secs
10. Davide Formolo (Ita/Bora) +15mins 16secs
22. Simon Yates (GB/Mitchelton-Scott) +1hr 15mins 11secs