A scrappy second half goal by Diego Costa broke a Persian stonewall and lifted Spain to a 1-0 win over Iran in a nerve-jangling russia 2018 clash on Wednesday.
Costa claimed his third goal of the tournament in the 54th minute at Kazan Arena 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.
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 defense for much of the night but also made a number of telling incursions.
A goal by Saeid Ezatolahi was ruled out offside after being reviewed by the video assistant referee (VAR), while Karim Ansarifard had earlier hammered into the side netting.
Iran coach Carlos Queiroz had rung in the changes, dropping captain Masoud Shojaei and forward Alireza Jahanbakhsh to the bench, while recalling holding midfielder Ezatolahi from suspension and promoting Mehdi Taremi.
The expectation that they would play well back was unfounded, however, even if they kept their shape superbly, restricting Spain to a handful of chances in the first half.
David Silva sent a free kick straight into the arms of keeper Ali Beiranvand in the 25th minute for Spain’s first shot on goal.
Silva was in the thick of it again at the half hour, with a pirouette and a volley over the crossbar at the end of a string of looping headers.
Silva found a rare meter of space just before the break and was denied again by a deflection off a player.
Spain seemed rejuvenated after the interval, with Sergio Busquets unleashing a searing long-range strike that forced Beiranvand into a brilliant double save.
Minutes later, however, Ansarifard latched onto a poor clearance and unleashed a withering shot that fired just wide of the left post.
Costa, who grabbed a brace in the 3-3 draw against Portugal, was in the right spot at the right time, his lucky deflection leaving the masses of Iran fans at Kazan Arena groaning in disappointment.
Costa grabs lucky goal as relieved Spain beat Iran 1-0