A scrappy second half goal by Diego Costa broke a Persian stonewall and lifted Spain to a 1-0 FIFA World Cup win over Iran in their group B game in Kazan.
Costa claimed his third goal of the tournament in the 54th minute but the striker hardly knew about it, the ball deflecting off his legs from an attempted clearance by hapless Iran defender Ramin Rezaeian.
The result left Spain joint top of their group with Portugal on four points, with Iran close behind on three going into the third and final set of games. After two defeats, Morocco are out.
Read more of our FIFA 2018 coverage:
After a match played out to a deafening blare from vuvuzela horns from a huge army of Iranian fans, Spain will feel relieved to have emerged with maximum points.
Iran were brilliant in defence for much of the night but also made a number of telling incursions.
Meanwhile Cristiano Ronaldo powered-home a fourth-minute header to give Portugal a 1-0 victory over Morocco that took them top of Group B and meant the unlucky North African side become the first to be eliminated from the tournament.
Ronaldo's fourth goal of Russia 2018, following his hat-trick in the 3-3 draw with Spain, took the European champions to four points. Iran have three points and Spain one ahead of their meeting later today.
Morocco, who had a real go at the Luzhniki Stadium but failed to convert their chances, are pointless having also lost 1-0 to Iran and cannot progress to the second round.
Portugal struggled to impose themselves and ended up defending for long spells, leaving coach Fernando Santos unimpressed. "We have to look at this, we lost control of the game," he said.
They qualified for the finals without conceding a goal in six matches yet somehow opted against marking the most dangerous attacker at the tournament in the six yard box when Joao Moutinho swung in a cross from a short corner and Ronaldo duly buried the header.
It was his 85th international goal, taking him beyond Hungarian Ferenc Puskas's European record, with only Iran's Ali Daei ahead of him on 109.
Luis Suarez marked his 100th international cap by sending Uruguay into the last 16 of the World Cup as the striker benefited from some poor goalkeeping to eliminate Saudi Arabia with a 1-0 win.
Suarez tapped in midway through the first half after keeper Mohammed Al-Owais failed to grab the ball on a corner. The goal put Uruguay second in Group A with a maximum six points behind hosts Russia.
Saudi Arabia, who have not won a World Cup game since their debut in 1994, have zero points, just like Egypt, who lost 3-1 to Russia yesterday.
Depending on the result of their last group game against Russia, Uruguay will take on either Spain, Portugal or Iran, who are still on course in Group B for a place in the quarter-finals.
Suarez has now scored in three consecutive World Cups.