The 22-year-old Bernal, the youngest man in the race, launched an attack three kilometres from the summit of the 23-kilometre Col du Galibier. He overtook Ineos teammate Geraint Thomas, the defending champion, in the standings to become Alaphilippe's main challenger in the next two daunting mountainous stages.
Bernal is second at 1min 30 sec from Alaphilippe with Welshman Thomas a further five seconds back in third. Steven Kruijswijk is fourth at 1min 47 and Thibaut Pinot fifth at 1min 50sec.
After 18 stages Bernal, who has been kept largely under wraps by Ineos, unfurled his wings and set off to put 31 seconds into the four men ahead of him in searing heat which reached 40 degrees Celsius (104 Fahrenheit).
"I'm here, second, and maybe I can win the Tour, but it's going to be really very hard to achieve that, for now I'm second," said a serene looking Bernal.
"There are five other guys still in there," he said.
For Quintana the stage win saved the 29-year-old's Tour de France. The Movistar captain blew his lines in the Pyrenees, but gained almost six minutes on the main contenders to finish the first full day in the Alps seventh overall.
Alaphilippe seems unstoppable. After he was dropped on the climb, the Frenchman galvanised himself, limiting his losses before the crest, and then catching all his rivals, except Bernal, with a virtuoso descent, frequently adopting his 'supertuck' aerodynamic downhill crouch to stunning effect.
Alaphilippe looked like a man on fire after the race.
"I knew how hard it was going to be, they all wanted to attack me and they did," he said laughing.
"Look, I'm still in yellow," he said pointing to the overall leader's jersey he will don for a 14th time on Friday.
"When Bernal attacked I just hung on however I could and then let it rip on the descent."
"I took a lot of risks and really took great pleasure in that fight back," said Alaphilppe.
The former soldier and bike mechanic said he had been at the limit of his forces.
"I was running on instinct, I have trained this descent many times but I couldn't remember a thing coming down. I was at the very limit on most of those corners."
The other fancied Frenchman Pinot said after the race it had been a bad day for him.
"We couldn't follow Bernal and you have to be able to keep up with the best. Thomas also launched a big attack and we got him back so I suppose it was not so bad in the end," said the emotional Pinot.
It was also a day of redemption, of sorts, for French climber Romain Bardet, who had dropped to more than 25 minutes off the overall pace.
Even though he was dropped by Quintana in the battle for the stage win, Bardet claimed the polka dot 'King of the mountains' jersey as well his smile, after spending two weeks looking like a broken man.
Friday's stage from Saint-Jean-de-Maurienne to Tignes also features two dreadful mountain climbs with the first one topping out at 2800 metres while the race ends with a summit finish at the Alpine ski resort.
There is no descent at Tignes for Alaphilippe to catch up if he gets dropped again and when reminded of this fact the man who has worn the yellow jersey with style and bravery answered simply, "I know" and smiled again.
Leading results from stage 18 of the Tour de France on Thursday, raced between Embrun and Valloire:
1. Nairo Quintana (COL/MOV) 5hrs 34mins 15sec, 2. Romain Bardet (FRA/ALM) at 1min 35sec, 3. Alexey Lutsenko (KAZ/AST) 2:28, 4. Lennard Kämna (GER/SUN) 2:58, 5. Damiano Caruso (ITA/BAH) 3:00, 6. Tiesj Benoot (BEL/LOT) 4:46, 7. Michael Woods (CAN/EF1) 4:46, 8. Egan Bernal (COL/INE) 4:46, 9. Serge Pauwels (BEL/CCC) 4:46, 10. Steven Kruijswijk (NED/JUM) 5:18, 11. Emanuel Buchmann (GER/BOR) 5:18, 12. Thibaut Pinot (FRA/FDJ) 5:18, 13. Geraint Thomas (GBR/INE) 5:18, 14. Julian Alaphilippe (FRA/DEC) 5:18, 15. Rigoberto Uran (COL/EF1) 5:18, 16. Mikel Landa (ESP/MOV) 5:18, 17. Richie Porte (AUS/TRE) 5:18, 18. Warren Barguil (FRA/ARK) 5:43, 19. Alejandro Valverde (ESP/MOV) 6:16, 20. Guillaume Martin (FRA/WGG) 6:47.