Portugal needed 84 minutes to break down a stubborn Hungary team roared on by a crowd of more than 60,000 in Budapest before a deflected strike from Raphael Guerreiro put them ahead and Ronaldo then converted an 87th-minute penalty to score his 10th goal in the competition and overtake Michel Platini on nine goals.
Ronaldo then scored his 11th goal in the competition a few minutes later when he added a third for Portugal.
His two goals mean he now has 106 goal in 176 games for Portugal and is just four goals away from breaking another record and becoming the all-time international goalscoring record.
In front of the biggest crowd at a football match in Europe since the start of the coronavirus pandemic, it had looked like it would be a frustrating afternoon for Ronaldo and Portugal.
Ronaldo missed a sitter in the first half when he volleyed unmarked from six yards and Hungary had looked on course for an unlikely draw until they conceded three goals late on.
After Portugal survived a scare in the second half when Hungary substitute Szabolcs Schon had the ball in the net but was flagged offside, Guerreiro broke the deadlock in the 84th minute.
Ronaldo then broke the record when he scored from the penalty spot and he sealed the win in injury time.
With Germany and France to play next in the ‘group of death’ at Euro 2020, Portugal knew they needed to start with a win and this was an ideal start of their defence.