The Portugal superstar headed home in just the fourth minute of the Group B encounter in Moscow to surpass former Hungary and Spain striker Ferenc Puskas and move his tally to 85 on his 152nd appearance for his country.
Morocco went on to lose the game 1-0, becoming the first team to be eliminated from the global tournament.
Morocco, playing in its first World Cup in 20 years, linked play neatly through midfield but relied on set pieces for its clearest chances - a growing theme at this year's tournament.
The result was harsh on Morocco, as was their loss against Iran in their opening game, but it reflected their difficulty producing the telling final ball, despite so much good work in the other two thirds of the pitch. Bernardo Silva made a decision to take a short corner with the help of Joao Moutinho, who crossed a teasing ball to the six-yard box.
Portugal defender Pepe has been the subject of scrutiny on Twitter following a theatrical dive during his side's 1-0 victory over Morocco.
Amrabat was furious at not being awarded a penalty after wrestling with Raphael Guerreiro and the entire squad erupted in outrage.More news: Hornets traded Dwight Howard to the Nets
More news: Aquarius migrant rescue ship arrives in Spain
More news: Mexico player asks fans not to use homophobic chant
Mehdi Benatia forced a smart low save from Rui Patricio at a corner for Morocco, before Hakim Ziyach skipped his way into the Portugal area, his goal-bound effort blocked by an outstretched leg.
However, Portugal held out and go on to complete their first-round against Iran while Morocco face Spain, both on June 25.
Ronaldo's four goals top the individual scoring chart at the World Cup.
Van Marwijk maintains any of the 23 players in his Australian squad are a chance of starting against Denmark in Samara on Thursday.
Van Marwijk is tunnel-visioned on the challenge presented by a Danish team ranked No.12 in the world.
"The Danish, they are a strong team", van Marwijk told reporters.