Editor's note: How are you celebrating the World Cup? Join the global conversation on CNN Facebook Pulse
(CNN) -- Lionel Messi waited until injury time to break Iranian hearts Saturday and give Argentina a scarcely deserved 1-0 victory in Belo Horizonte in a Group F clash.
Iran had come close to pulling off a major upset with a series of second half chances until Messi found space just outside the penalty area to fire home an unstoppable shot.
It was his eighth goal in his last seven appearances for Argentina and could not have been more timely, a second win securing his side a last 16 place with a group match to spare.
Messi had also scored what turned out to be the crucial second goal in Argentina's 2-1 win over World Cup debutant Bosnia Herzegovina to open its Brazil 2014 campaign.
Before his superb strike, the four-time FIFA World Player of the Year had been kept largely quiet by the dogged defense of the Iran, who had drawn with Nigeria in its opener.
Argentina dominated possession in the first half, but Iran's Jalal Hosseini had perhaps the best chance -- however the defender headed over the bar from a corner.
Iran took the upper hand after the break, with Reza Ghoochannejad heading straight at goalkeeper Sergio Romero in the 53rd minute when he should have scored.
Ashkan Dejagah then appeared to have won a penalty soon after when he was brought down in the area by Pablo Zabaleta, but Serbian referee Milorad Mazic waved play on.
Dejagah was denied a goal in the 67th minute when the forward beat Zabaleta to a cross, but saw his header tipped over the bar by Romero.
Reza also had a great opportunity to secure a famous victory with five minutes remaining, but it was Romero again to the rescue for Argentina with another fine save.
"They made the game very difficult for us," admitted Argentine coach Alejandro Sabella after his side's last-gasp victory.
"Messi was marked very tightly, but he showed perseverance, patience, attitude and always looked for the goal. He never gave up."
Sabella's Iranian counterpart Carlos Queiroz also praised Messi, but was unimpressed by the referee's performance in denying his side a second half penalty.
"Messi was fantastic, but the referee wasn't," said the former Real Madrid coach.
"I don't understand it, he had to have seen it was a penalty. He was five meters away, there is no way he couldn't have seen it."
Nigeria 1-0 Bosnia
Later Saturday, Nigeria consolidated second spot in Group F behind Argentina with a 1-0 win in Cuiaba over Bosnia, who are eliminated.
Peter Odemwingie's 29th minute goal secured victory for the Super Eagles, who drew with Iran in the opening round of matches.
Bosnia was left to curse its luck, with Edin Dzeko having a goal mistakenly ruled out for offside in the first half, while in stoppage time the Manchester City striker saw his effort strike the post.
But Nigeria also carried an attacking threat and Emmanuel Emenike might have added a second only to see his late effort go just wide of the post.
It was Nigeria's first win at a World Cup since 1998 and they will face Argentina in the final group games Thursday.