Philippe Coutinho added a third goal with a superb curling strike from long range in the 61st to cap arguably the best performance by the former Liverpool player since joining Barcelona just over a year ago.
Twenty years ago at Barcelona's stadium, United manager Ole Gunnar Solskjaer completed one of the most memorable comebacks in soccer history when he scored the English team's second injury-time goal to stun Bayern Munich in the 1999 Champions League final. But after a promising start when Marcus Rashford hit the crossbar, Messi showed that sentimental memories mean very little when he is playing at his best.
The goals ended Messi's bizarre scoring drought in Champions League quarterfinals that had reached 12 matches dating back to 2013.
They took his tournament-leading tally to 10 this season. In total he has 45 goals in 42 games through all competitions.
Having already seen off Real Madrid in the previous round, Ajax showed no fear against Ronaldo and the Italian giant either, advancing 3-2 on aggregate after dominating much of the game.
Even going behind to a goal from Ronaldo in the first half didn't faze Ajax's young players as Donny van de Beek leveled shortly after and 19-year-old captain Matthijs de Ligt scored the winner in the second half.
Ajax will play either Manchester City or Tottenham in the semifinals.
It is the first time since 2010 that Ronaldo failed to reach the last four, having won the competition the last three years in a row with Madrid. His old rival Lionel Messi is very much in contention, though, after scoring two goals to help Barcelona beat Manchester United 3-0 and progress 4-0 on aggregate in Tuesday's other quarterfinal.
Juventus signed Ronaldo in the offseason in the hope of ending a 23-year wait for the Champions League.
The 34-year-old Portugal forward scored a hat trick in the previous round against Atletico Madrid to almost single-handedly overturn a two-goal deficit, and had also found the back of the net in Amsterdam. He added his fifth goal in three Champions League matches in the 28th minute on Tuesday, heading in a Miralem Pjanic corner.
But Ajax leveled six minutes later when Hakim Ziyech's mishit shot turned into an assist for Donny van de Beek, who beat the offside trap to redirect it past Juventus goalkeeper Wojciech Szczesny.
Ajax grew in confidence in the second half and had a number of chances to take the lead, with Szczesny making a couple of stellar saves to keep the game level. But Juventus continued to look vulnerable without captain and key defender Giorgio Chiellini, and Ajax finally found its breakthrough in the 67th as De Ligt outjumped both Daniel Rugani and Alex Sandro to head in a corner.
- AP