Spain edged out a gallant Iran in an absorbing contest to ensure they will reach the World Cup knockout stage with a win in their final group game.
The 2010 champions needed a fortuitous Diego Costa goal after half-time, having been frustrated in an opening period in which they had 81% of possession.
Iran, who defended admirably until the ball ricocheted in off Costa, instantly showed more intent and thought they had levelled, only for Saeid Ezatolahi’s strike to be ruled out for offside.
Carlos Queiroz’s Iran side had gone close through Karim Ansarifard and Mehdi Taremi before the crucial offside call and their endeavour throughout seemed to endear them to the crowd at the Kazan Arena.
They survived a chaotic goalmouth scramble where Gerard Pique somehow failed to turn home from a yard out, but again showed heart and threatened late on, with Taremi heading over when well placed.
Fernando Hierro, installed as Spain manager two days before the World Cup started, knows his side will reach the knockout stage if they beat Morocco on Monday. A draw will suffice if Iran fail to beat Portugal.
Spain may feel they have faced several noteworthy hurdles already throughout their stay in Russia.
The sacking of coach Julen Lopetegui before the tournament was followed by a last-minute equaliser by Portugal in their opening game. Then came this significant examination.
Spain are accustomed to dominating possession against sides content to soak up pressure, but Iran’s deep 4-5-1 set-up in the first half afforded Spain only one shot on target. Costa cut an isolated and frustrated figure, with 12 first-half touches.
Iran set a record of 1,121 minutes without conceding a goal in qualifying and only after the break did Spain begin to find holes in a well-drilled defensive block, with Sergio Busquets forcing a fine save and Pique unable to flick home in the six-yard box.
And the momentum told, with a Ramin Rezaeian clearance hitting Costa and finding the corner of the net. It was Costa’s ninth goal in his past nine international starts.
The fact he continued to hassle Iran’s defenders on a night when he was so often crowded out of the game is to his credit and, after scoring twice against Portugal, he looks to have made the lone striker role his own.
Spain top Group B courtesy of having collected fewer disciplinary points than Portugal.
Several Iran players slumped to the turf at the final whistle, unsurprising given they had pushed one of the tournament favourites so close.
This was their first competitive defeat since the 2014 World Cup and the way they switched from a defensive focus to chase the game after falling behind showed they have more to offer than simply a stiff rearguard.
Ansarifard’s lashed volley left David de Gea motionless but found the side netting, while Taremi failed to hit the target with two headers, notably late on when he rose unchallenged.
Although Ezatolahi stabbed home from close range, the assistant referee – and later the VAR – spotted he had strayed offside when the ball was flicked on.
The way they kept out Pique in an almighty goalmouth scramble again underlined their grit, but Iran failed to find the target with their seven shots.
Queiroz said the Spain match was Iran’s “game of the universe”. Their fixture in Saransk on Monday now arguably deserves a bigger title.
A win would send them through and a draw could prove enough if Spain lose to Morocco.