Cristiano Ronaldo started his Qatar World Cup with a victory on Thursday as Portugal triumphed 3-2 over Ghana.

In what was a closely fought affair, Ronaldo's team ran out narrow winners on the day after a flurry of second half goals.

Ronaldo opened the scoring from the spot in the 65th minute and in doing so became the first person in history to score at five separate World Cups.

Andre Ayew, formerly of Swansea, hit back in the 73rd to level proceedings.

But then two quickfire strikes from Joao Felix and Rafael Leao effectively put the game beyond Ghana.

Or at least, that's what everybody thought...

Osman Bukari's 89th minute goal gave the African nation hope.

And then with just seconds left to play, Portugal's goalkeeper, Diogo Costa, nearly made one of the most noteworthy errors to have occurred in a World Cup.

Unaware that Inaki Williams was lurking behind him, instead of kicking the ball out of his hands and up to the opposing side of the pitch, Costa casually rolled it in front of him.

Williams saw his opportunity and pounced, but thankfully for Costa, he slipped when trying to turn and couldn't convert the chance.

It really was one of the closest of close calls and could have been incredibly embarrassing for the keeper.

WATCH: Costa's error

After the game, Costa looked dejected despite his team securing a vital three points.

He clearly couldn't believe he had been so careless in his play.

However, Costa's misfortune proved the perfect opportunity for Ronaldo to show his leadership and he did exactly that after the game.

VIDEO: Ronaldo proves he's an elite captain

In a video shared to Twitter, Ronaldo can be heard saying to Costa.

"You have to laugh, we won. Did you concede a goal?"

Costa responded: "No, but he was close."

"Then? You have to laugh, we win!" Ronaldo chimed. "Another victory and we go, you can laugh, let's go! We won."

Well played, Ronaldo. As the Portugal squad's captain and most senior member, it's great to see Ronaldo displaying such inspirational leadership qualities.

A World Cup isn't lost on matchday one, nor is it won. However, the attitude and mentality of a team's players is vital if they want to overcome every obstacle before them and reach glory.

And with Ronaldo at the helm, we're not sure you can find a more elite mentality anywhere in the world.

Fan reaction