A first-half brace from Ronaldo sandwiched a Diego Costa goal to give the defending European champions a slim lead after 45 minutes in Sochi. And a dramatic late Ronaldo free kick cancelled out second-half goals from Costa and Nacho to secure a thrilling draw on the night.
The match started brightly for the Portuguese, who wasted little time to work the opener.
Ronaldo won a penalty in just the third minute when his quick stepover caught out Real Madrid teammate Nacho, whose clumsy lunge clipped him just inside the box.
A VAR review confirmed the foul and Ronaldo then finished the job from the spot, sending Spain goalkeeper David De Gea the wrong way to give Portugal a surprising early lead.
The goal marked the second-fastest goal in Portugal's World Cup history, falling only behind Jose Augusto's strike against Hungary at the 1966 edition in England.
Spain worked their first chance on 10 minutes -- Costa cushioning down a cross in the box for David Silva to volley high with his less-favoured right foot.
Silva saw a close-range shot blocked for a corner kick in the 22nd minute and Portugal nearly scored from the resulting cross, Ronaldo setting up Goncalo Guedes whose indecision allowed a recovery run to poke the ball away before he could shoot.
Portugal would rue the missed opportunity seconds later when Costa out-fought Pepe to a 50-50 ball, settled at the top of the box, patiently worked the ball onto his right foot and beat keeper Rui Patricio with an excellent shot across the Sporting man's face to equalise.
Isco thought he scored Spain's second soon after but his sweetly struck volley from the edge of the box struck the underside of the crossbar and then the goal line before bouncing back into play.
Spain worked another good chance in the 35th minute but Andres Iniesta dragged his first-time shot inside of the box just wide of the far post.
Ronaldo made that miss pay just before the break with his second of the day -- his low-and-hard shot receiving an assist from De Gea, who shockingly bundled what should have been an easy save into his own net.
The lead wouldn't last long, though, as Costa collected his second 10 minutes after the restart when he tapped home after a smart Sergio Busquets header found him free of his marker at the goalmouth.
Nacho made up for his earlier error in spectacular fashion three minutes later with a smashing right-footed volley from outside of the box that banged off both posts before settling into the net.
But Ronaldo would have the final say two minutes from time as his free kick from the top of the box lept over the wall and then dipped under the crossbar to give his country an important late point on the night.
Spain are back in action on Wednesday against Group B leaders Iran in Kazan, while Portugal will look for their first win against Morocco in Moscow.
KINDLY DROP A COMMENT BELOW