Bosnia beat Iran 3-1 in their Group F finale on Wednesday to record their first World Cup win and deny the West Asians any chance of reaching the knockout stage.
Already eliminated after two losses, Bosnia, appearing at a major tournament for the first time as an independent nation, went ahead in the 23rd minute through Edin Dzeko.
Bosnia doubled their lead just before the hour through Miralem Pjanic's cool finish before Reza Ghoochannejhad pulled a goal back for Iran in the 82nd minute.
Avdija Vrsajevic restored Bosnia's two-goal cushion with a fine strike a minute later.
- Photos: Argentina continue to Messi-merize; Bosnia end with a win
Iran had required all three points against Bosnia and needed Argentina to beat Nigeria to have any shot of grabbing a surprise place in the last 16.
The Argentines beat Nigeria 3-2 in Porto Alegre to top the group on nine points with the Super Eagles going through as runners-up with four. Bosnia finished with three and Iran one.
Bosnia opted to ditch a cautious 4-5-1 setup in favour of the attack-minded 4-4-2 that brought them 30 goals in qualifying, restoring Vedad Ibisevic up front alongside Dzeko.
The result was a more controlled performance, the Bosnians bossing most of the first half and taking the lead when Dzeko dropped deep into space to collect a pass before travelling to fire in low off the post from just outside the box.
Iran almost got level seconds after the restart when Masoud Shojaei struck the crossbar with a deft chip.
In a scrappier second half, Bosnia scored a second when Dzeko picked up a loose ball that allowed Tino Sven Susic, nephew of Bosnia coach Safet Susic, to slide in Pjanic for a tidy finish.
Despite the roars of support the dogged defensive qualities that have won Iran plaudits in Brazil suddenly looked a little ragged and they struggled to reproduce the swift attacks that had worried twice champions Argentina in their last game.
Ghoochannejhad provided a moment of cheer when he ensured Iran would avoid being the only team not to score in Brazil, scoring from close range after Bosnia failed to clear their lines quickly enough.
The cheers were short lived though as right back Vrsajevic's marauding run saw him played in to thunder a third home off the far post, earning Bosnia their first win over Iran in six attempts.
- Complete coverage of the football World Cup
Image: Edin Dzeko scores Bosnia and Herzegovina's first goal against Iran
Photograph: Laurence Griffiths/Getty Images