The first half was a drab affair with neither side able to break the deadlock.
But it well and truly burst into life in a quite chaotic second half.
Cristiano Ronaldo opened the scoring in the 65th minute as he converted from the penalty spot.
That goal meant he became the first player ever to score in five World Cups.
Ghana equalised seven minutes as Andre Ayew tapped home.
Portugal rallied and scored twice in two minutes to go 3-1 up. Joao Felix ran through on goal and produced an expert finish to give his side the lead once more.
Soccer Football – FIFA World Cup Qatar 2022 – Group H – Portugal v Ghana – Stadium 974, Doha, Qatar – November 24, 2022 Ghana’s Osman Bukari celebrates scoring their second goal REUTERS/Hannah Mckay
Moments later, Leao, who started the game as a substitute, cooly rolled the ball past Lawrence Ati-Zigi and into the corner of the net.
But Ghana set up a grand stand finish through Bukari.
The ball was crossed into the box and the Red Star Belgrade player planted his header in the back of the net.
And, after scoring to reduce the deficit to one goal once more, Bukari did Ronaldo’s ‘Siuuu’ celebration.
GMS World Cup Hub
The 37-year-old superstar was watching on from the bench having being substituted minutes earlier.
The camera panned to Ronaldo and he did not look too happy as he shouted something and threw his hand up in disgust. Watch the moment below…
VIDEO: Bukari does Ronaldo’s celebration in Portugal vs Ghana
Ghana aren’t done yet! 👀
— ITV Football (@itvfootball) November 24, 2022
Ghana had a golden opportunity to equalise in the dying moments when Diogo Costa dropped the ball inside the box and Inaki Williams nipped in.
But Williams slipped at the vital moment and Portugal were given a huge let off.
Portugal then held out to secure the most dramatic of three points to open up their campaign in Qatar.
Fernando Santos’ side are top of Group B having seen off Ghana. The other game in the group finished in a drab 0-0 draw between Uruguay and South Korea.
You can find all the latest football news and rumours right here: