The victory in Kazan puts the 2010 winners on course for the last 16, but Iran had an equaliser disallowed for a narrow offside.
"We have three points... but it was very difficult and complex game. Both halves were very tough," said Hierro. "We started well, with good pace, but Iran are a very tough team, it's very difficult to score against them."
Costa, who scored twice in a 3-3 opening draw with Portugal in Sochi, courted controversy early in the Group B encounter when he stepped on the toes of Iran 'keeper Ali Beiranvand.
His gesture went unpunished, and the Atletico Madrid striker required another stroke of luck on 54 minutes when his shot came off Ramin Rezaeian to beat Beiranvand after he had been sent through by Andres Iniesta.
Just before the hour mark, the entire Iranian bench poured onto the pitch when Saeid Ezatolahi fired an equaliser for Iran.
But the thousands of Iranian supporters that filled the stadium with the sound of vuvuzelas throughout were left disappointed when it was ruled out for offside.
With three points from two matches, Iran still have a chance of qualifying if they can get a result against Cristiano Ronaldo's Portugal on Monday.
Iran coach Carlos Queiroz hailed the bravery of his side and pledged they would fight to make the last 16.
"We left the pitch 1-0 down, but we won respect. I'm sure the fans are proud of our team," said Queiroz. "Our players can go home and sit with their family and friends and be proud of themselves. People gave us no chance, but we still have chances to qualify for the second round. We'll fight for our dreams."
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ