Nibali has been on the hunt for a stage win ever since the race reached the mountains, and finally managed to snag a victory with an impressive display, not only to attack out of the break but to hold off the cadre of strong climbers coming from behind.
"It’s been a feeling of liberation when I crossed the line because the last few hundred metres felt like never ending," said Nibali.
Nibali attacked with 12 kilometres to go, shedding Michael Woods (EF Education First) as the last of his breakaway companions and lasting all the way to the finish.
"My only way to make it was to attack from far out," said Nibali. "With the advantage we had at the bottom of the climb, I believed I could make it. I hadn’t won since last year. It’s a nice revenge."
Bernal all but confirmed his Tour de France overall victory with a fourth-placed finish on the stage.
“We’re now close to making it official," said Bernal. There’s one stage left, but normally if everything goes well, I can say that I’ve won my first Tour.
“The last climb has been very hard. Jumbo-Visma rode hard to make the podium. We were in a comfortable situation and I felt really well. I’m happy."
Bernal's soon-to-be victory will be the first in Colombia's history with the 22-year-old recognising the enormity of the occasion.
"We used to watch the Tour on TV and we thought it was something unreachable," said Bernal. "As a kid, you think 'how cool it would be to be there one day', but it looked so far away. Here we are and I’m very emotional.”
"It’s incredible to think that I have won my first Tour. I just want to get to the finish line in Paris tomorrow and after I’ll be calmer. Colombia is on the verge of winning its first Tour - I feel this is not only my triumph but the triumph of a whole country.
"We already had the Giro, La Vuelta, but the Tour was missing and it’s a great honour to think that I’m the one achieving this. My dad couldn’t talk at first but when he managed, he congratulated me. He was about to cry. For us, it’s a dream."
Stage 20 was shortened by landslides and saw the riders tackling just a 59.5 kilometre course with a massive climb to the summit finish in Val Thorens.
A breakaway got itself established quickly, but with a monster 33-kilometre climb awaiting the riders into the finish, none of the big names decided to jump in the early move. The large group of 31 riders established a lead of two and a half minutes going into the foot of the Val Thorens, with the pace expected to be ferocious behind.
George Bennett (Jumbo-Visma) laid down a solid pace for most of the first half of the climb, drawing the breakaway's advantage down to less than a minute.
Nibali chanced his luck with an attack from the breakaway with 12 kilometres remaining but the grinding pace of the peloton continued behind.
Richie Porte (Trek-Segafredo) was the first of the general classification candidates to crack, with the former yellow jersey-wearer Julian Alaphilippe not lasting much longer as the pace of Jumbo-Visma told upon the Frenchman.
Simon Yates (Mitchelton-Scott) tried an attack from the peloton with six kilometres left in the race which started a flurry of attacks from the diminishing group of favourites. Nibali held just over a minute's lead at this point and kept grinding his tempo on the long climb.
Marc Soler (Movistar) was the most impressive of the attackers from the peloton, though at best he just dangled in front of the BORA-hansgrohe-led main group.
Nibali continued on in his solo pursuit and ended up taking a famous win as he outlasted the group of favourites, throwing up his arms in a tired salute.
A number of GC contenders tried to attack in the final kilometre, but none gained a significant advantage, with Alejandro Valverde (Movistar) finishing second on the stage and Mikel Landa (Movistar) third.
Egan Bernal and Geraint Thomas (both Team Ineos) crossed the line together, with Thomas the first to congratulate his 22-year-old team-mate after securing the yellow jersey with a strong ride.
Richie Porte moved out of the top ten after cracking early on the climb, falling to 11th, while Alaphilippe slid down to fifth.