A fortuitous Diego Costa goal helped Spain overcome a dogged Iran to secure a 1-0 win in their World Cup Group B clash in Kazan.
Carlos Queiroz's side produced a defensive masterclass to reduce Spain to nothing more than half-chances during a hugely frustrating opening 53 minutes for the 2010 champions.
Costa - who scored twice in Friday's pulsating 3-3 draw with Portugal - eventually found the breakthrough, though, when Ramin Rezaeian's attempted clearance cannoned off his leg and into the bottom-left corner.
Iran had the ball in the back of the net just eight minutes later courtesy of Saeid Ezatolahi, but their wild celebrations were cut short after referee Andres Cunha was advised by VAR that Rezaeian's vital intervention had been made from an offside position.
Sometimes luck is all you kneed.— FOX Soccer (@FOXSoccer) June 20, 2018
(we'll see ourselves out) pic.twitter.com/B6arwyukFU
Iran's approach was far more positive following Costa's strike, Mehdi Taremi heading just over from close range in what was their clearest opportunity to find an unlikely leveller.
The win moves Spain level on points with Portugal at the top of Group B and they know victory against Morocco on Monday will be enough to secure qualification for the knockout stages. Iran, meanwhile, face Portugal on the same day needing a win to progress at the expense of Cristiano Ronaldo and Co.
Spain handed a 100th cap to Gerard Pique, with Dani Carvajal and Lucas Vazquez the only new faces from the side that drew against Portugal.
Any thoughts that Iran would be blown away by their more illustrious opponents soon dissipated as their expertly drilled defence comfortably rebuffed wave after wave of Spanish attack in the opening stages.
Fernando Hierro's side had to wait until the 25th minute for their first attempt on goal, David Silva's long-range free-kick comfortably held by Alireza Beiranvand.
The Manchester City midfielder came closer to breaking the deadlock five minutes later, but his hooked volley sailed narrowly over the crossbar from six yards out.
Spain's frustration was in danger of boiling over shortly before the interval when Costa got involved in an unnecessary spat with Beiranvand, although referee Cunha opted not to punish the combative striker.
Iran's resistance was nearly broken twice in quick succession at the start of the second period.
First, Pique's close-range effort was blocked and then Beiranvand palmed away Sergio Busquets' curled effort from the edge of the penalty area.
The Asian side almost scored the most unlikely of openers when Karim Ansarifard's instinctive effort from a corner flashed into David De Gea's side netting.
That near-miss was brought into sharp focus less than 60 seconds later when Costa picked up Andres Iniesta's pass inside the area and saw Rezaeian's attempted clearance ricochet off his leg and past the helpless Beiranvand.
Ezatolahi thought he had pulled Iran level shortly after the hour but his close-range finish after a scramble was ruled out courtesy of VAR after Rezaeian had strayed into an offside position.
Taremi's back-post header fizzed over De Gea's crossbar seven minutes from time as Iran pushed for an equaliser, but Spain held on for a 1-0 win they certainly deserved.