Spain are now joint top with Portugal on four points after they beat Morocco 1-0 earlier.
Spain's midfield probed endlessly, pulling Iran this way and that as they attempted to plot a way through a seemingly endless sea of defenders - an experience their vastly outnumbered fans will have had to endure in the city during the day.
Spain's Diego Costa (second left) is spoken to by referee Andres Cunha from Uruguay after appearing to stand on Iran goalkeeper Ali Beiranvand foot, who sits on the ground.
Then, trailing in the second half, Iran almost equalized when Saeid Ezatolahi had a goal ruled out on video review.
Queiroz's troops continued to threaten as the second half went on, with Mehdi Taremi heading over the crossbar at the far post on 81 minutes.
A few more chances followed but luck was not on Iran's side.
First place in the group could be decided by goal difference.
Facing a very compact Iranian team that came out to defend, Spain pressed high and controlled much of the game but found it hard to threaten against Iran's 10-man defence.
First, Pique's close-range effort was blocked and then Beiranvand palmed away Sergio Busquets' curled effort from the edge of the penalty area.
"But this was our first match point, if we compare this to tennis, our second match point comes against Portugal".
"What game were you watching?" Spain now face Morocco, who are eliminated from the tournament after losing to Portugal on Wednesday, in the third and final game of the group stage.
For Iran to finally achieve their dream against Portugal, Queiroz thought, would be all the more remarkable given the gulf that has opened up between European countries and the rest of the football world.
Spain coach Fernando Hierro welcomed Real Madrid's Dani Carvajal back into the starting line-up following his recovery from a hamstring injury suffered in the Champions League final win over Liverpool.
Hierro acknowledged his own team will need to improve after they allowed themselves to grow frustrated with Iran's dogged defensive performance until Costa's timely breakthrough. We all know it's tough to play them.