Andre Ayew's equaliser briefly looked like it would spoil Portugal's party, but a quickfire double from Joao Felix and substitute Rafael Leao gave them a two-goal advantage.
Osman Bukari halved it with an 89th-minute header but Portugal held on through nine minutes of injury time to seize the initiative in Group H, where Uruguay and South Korea earlier played out a goalless draw.
The former Manchester United number seven was the first to get the crowd on their feet in the 10th minute, racing onto an Otavio pass after Mohammed Kudus was caught in possession.
However, the ball just ran away from him and goalkeeper Lawrence Ati won a 50-50 foot race to block Ronaldo.
The 2016 European champions were dominating possession and pressing Ghana high up the pitch whenever the ball was lost, but it was a scrappy encounter.
Openings were few and far between, and Atletico Madrid forward Felix summed up the lack of a quality as he leant back and lifted a left-foot shot high over the top in the 28th minute.
Ronaldo had the ball in the net after half an hour but the goal was disallowed for his shove on Ghana defender Alexander Djiku.
Portugal were still on top territorially and as the half came to a close, Otavio was off target with a shot after Joao Cancelo spotted his run from left to right across the box.
Ghana enlivened a slow start to the second period as Kudus broke from deep, got away from Ruben Neves and drilled a low left-foot shot just wide of Diogo Costa's goal.
Alidu Seidu was given a stern word and a yellow card by American referee Ismail Elfath after he flicked his head towards Felix.
The goal Portugal and Ronaldo craved arrived in the 65th minute, after the referee judged that Ghana's Southampton defender Mohammed Salisu had tripped the 37-year-old superstar in the box.
Almost every fan in the Portuguese end behind the goal had their smartphones poised as Ronaldo stepped up and made World Cup history, with Ati guessing the right way but not getting close to the ball.
Ghana responded positively though and equalised in the 73rd minute.
Kudus stung Costa's palms with a thumping left-foot shot and seconds later broke clear on the left side of the area. Danilo Pereira got in a tangle trying to clear his low cross and it fell to Ayew, who swept home from close range.
However, Portugal were gifted the chance to restore their lead when Baba Rahman allowed Bruno Fernandes' through-ball to reach Felix, who advanced on goal before clipping the ball beyond Ati.
The game appeared to have been put to bed when Fernandes burst forward again from deep, this time picking out substitute Leao to his left who rolled an angled shot home.
Ronaldo raced clear in search of his second and Portugal's fourth but this time Ati denied him.
Bukari's header made the final moments more tricky, but Portugal held out despite a late moment of madness from goalkeeper Costa, who almost cost his side dear when he failed to spot Inaki Williams lurking behind him.