Diego Costa scored the only goal as Spain managed a 1-0 win over Iran in their Group B tie on Wednesday at the ongoing FIFA World Cup in Russia.
Iran, who secured a win in their first group game against Morocco, needed to avoid defeat to stay in pole position to make it to the Round of 16.
Though they were able to stop the Spaniards from scoring in the first 50 minutes, they had no answer when Costa broke the deadlock in the 54tth minute.
Spain made the breakthrough when Costa turned inside the Iran box before Hosseini smashed ball against the Atletico forward, and the ball dropped into the corner.
Though Spain was well ahead in terms of possession, they could not increase their tally and were even lucky as Iran were denied a goal courtesy of the VAR technology.
With the win Spain are level on four points with Portugal and would face already eliminated Morocco.
On the other hand, Iran can still progress if they beat Portugal in their first final group game.