Joao Mario was on the pitch to witness Cristiano Ronaldo stun Spain again just days after the shock departure of their head coach Julien Lopetegui, his hat-trick securing an amazing 3-3 World Cup draw in Sochi.

Ronaldo had scored just three times in 13 appearances in World Cup finals - but the Real Madrid superstar matched that during an incredible 90 minutes.

Diego Costa twice cancelled out efforts from Ronaldo - his second the result of an absolute howler from David de Gea - before full-back Nacho, of all people, struck a blistering volley which flew in off a post.

But Ronaldo completed the 51st hat-trick of his career two minutes from time, leaving De Gea rooted to the spot as he sent a delicious free-kick over the Spain wall and into the corner of the net.

West Ham loanee Mario had to settle for a place on the bench but came on in the 68th minute to replace Bruno Fernandes as Portugal battled back for their opening game point.

Ronaldo's world-class performance came on the day his off-field life gained its fair share of headlines. It was widely reported he had agreed to accept a fine and a suspended jail term to settle an ongoing tax case in Spain.

If he had things on his mind, it did not show, as he gave Spain another headache.

Two days earlier their World Cup campaign had been thrown into disarray by the dismissal of Lopetegui, sacked for accepting the Real Madrid job just weeks after committing himself to the national team until 2020.

No Lopetegui, no problem. Or so it seemed as Spain took charge for long periods.

Fernando Hierro, once of Real and Bolton, had taken charge and watched as this Spain team purred like few others are able to do.

But Spain made life difficult for themselves, from Nacho's needless early challenge on Ronaldo which allowed the Portuguese predator to score from the spot, to De Gea's moment of madness.

And in the end, Ronaldo's remarkable records stood tall.

Inside four minutes Ronaldo became the fourth player to score at four different World Cups, and the first to do so at eight consecutive major international tournaments.

For long periods, Portugal were no match for their Iberian neighbours, who are now 21 games unbeaten.

They remain serious contenders to reclaim the trophy won in South Africa eight years ago, even if Ronaldo left a question mark against their defensive capabilities.

The game instantly burst in to life when Ronaldo tricked Nacho and did not need a second invitation to tumble over the defender's dangling leg.

Ronaldo shunned De Gea's mind games - the goalkeeper leaving his line for a quick word - and sent the ball to the right-hand corner as the Spaniard dived the other way.

It was a hammer blow for Spain but there was no panic, they probed in possession and created chances with David Silva firing over and seeing another effort blocked after Andres Iniesta weaved to the byline.

Portugal, meanwhile, menaced on the break with Ronaldo always in the forefront of their counter-thrusts.

Spain levelled after 24 minutes when Costa beat Pepe in the air and kept his composure to drill the ball low past covering Portugal defenders and goalkeeper Rui Patricio.

Costa's initial challenge came under the scrutiny of the Video Assistant Referee system but it rightly stood.

Two minutes later Portugal did escape when Isco's thunderous 20-yard strike left the crossbar shaking but did not cross the line.

Spain continued to draw pretty patterns and Iniesta ended one such move by dragging wide of the far post.

But, just as Portugal seemed to be holding their collective breath for the half-time break, the direction of the contest was turned on its head.

Ronaldo tried his luck from a central position 20 yards out and his number came up, De Gea letting the low drive to slip his grasp in a truly desperate moment for the Manchester United goalkeeper.

But the error was not fatal as Silva floated a 54th-minute free-kick to the back post that Sergio Busquets nodded down and Costa finished from inside the six-yard box.

Four minutes later Nacho's sweet drive cannoned in off a post and that was the signal for Spain to take control. A fourth goal seemed likely.

But Ronaldo, as he so often does, had the final word to spark Portuguese joy and another Spanish inquisition.