Hierro brought winger Lucas Vazquez into his starting side in place of midfielder Koke, seeking more dynamism to break down Iran's wall.
Costa's goal came in the 54th minute as a defender tried to kick the ball away.
After 10 minutes, the Iranians managed to send the ball into the net, but the referee for offside, rightly cancelled the goal of Sayyid Assadollahi. With Spain and Portugal both having secured a win and a draw and Portugal expected to trounce Iran on Monday, both Iberian countries will nearly certainly proceed to the knockout stage of the tournament, leaving Morocco and Iran out of the running. Do not cut, copy or lift any content from this website without our consent.
Spain are now level with Portugal on four points after two games, and will progress to the last 16 with a point against Morocco.
After a boring first half ended in a stalemate, Diego Costa gave La Roja the lead when his attempted shot took a big deflection off Ramin Rezaeian and into the back of the net.
"It's our second game and it's hard, but we want the three points to give ourselves options for the third game".
"We don't have these players, the super players they have", Queiroz said.
Fernando Hierro, Spain's sporting director, is now at the helm but barely a week into the tournament La Roja - expected to join Brazil, Germany and France in the latter stages - have endured more drama than they would have wanted or expected. When asked about what achievement he wants to make, he said that athletes always want to achieve the highest possible title, and they are now hoping to win the World Cup here.
After parking the bus for so long, the Iranian team searched for an equalizer.
Queiroz has proved to be a very valuable asset to Iran.
Moreover, Carlos Queiroz's side conceded just two goals and were unbeaten in their qualifying campaign, so it seemed unlikely that they'd be pushovers - even for a side of Spain's calibre. Iran was also unsafe on the break, using the speed of its attacking players to threaten the Spanish back four but without creating many real chances.
Social media has exploded over a freaky "phenomenon" involving Spain and their World Cup-winning former coach.
"It's true, maybe we were happier after Portugal, but we got three points today".