Cristiano Ronaldo scored a hat trick, capped by a dipping free kick in the 88th minute as Portugal and Spain played to a wild 3-3 draw in the Group B opener for both countries.
Ronaldo scored twice in the first half, only to see Spain rally for a 3-2 lead after two goals in three minutes early in the second half. Nacho Fernandez put Spain in front with a weaving half-volley from outside the penalty area in the 58th that bounced off the inside of the far post and trickled into the net.
Ronaldo had one more brilliant moment to come. Earning a free kick from about 20 yards out, Ronaldo's shot got just high enough over the wall and dipped under the crossbar. Goalkeeper David De Gea never moved and the Iberian neighbors each earned a point.
Ronaldo scored on a penalty kick he earned in the fourth minute and again just before halftime on a left-footed shot from the top of the penalty area that De Gea should have saved.
Diego Costa scored twice for the Spaniards, including a 55th-minute tally off a beautiful set piece set up by Andres Iniesta's chip to the end line and a Sergio Busquets header back into the middle of the penalty area.
The draw capped a week of turmoil for Spain after the firing of coach Julen Lopetegui.
Meanwhile, both Uruguay and Iran won their opening games at the World Cup on Friday by a score of 1-0 thanks to late goals.
Jose Gimenez came to Uruguay's rescue by heading home a free kick in the 89th minute to defeat Egypt in Group A, while in Group B, an Iranian free kick was turned into Morocco's net by a Moroccan player in the fifth minute of injury time.
Iran exploded with joy when striker Aziz Bouhaddouz dived to reach a curling cross from the left but headed the ball past goalkeeper Monir El Kajoui. It was Iran's second win in 13 matches at the World Cup, and Asia's first since the 2010 tournament in South Africa.
With Spain and Portugal the other teams in Group B, Friday's match in St. Petersburg was regarded as a must-win game for the two outsiders.
Russia leads Group A on goal difference after beating Saudi Arabia 5-0 on Thursday in the tournament's opening match. Uruguay is now second, also with three points.
Egypt forward Mohamed Salah was on the bench for his country's first World Cup match since 1990 after injuring a shoulder while playing for Liverpool in last month's Champions League final. Salah was the Premier League's player of the season after scoring a league-leading 32 goals, with 44 in all competitions.