Bosnia-Herzegovina beat Iran 3-1 in their Group F finale 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, who drilled a left-foot shot past Iran goal-keeper Alireza Haghighi.
Bosnia doubled their lead just before the hour through Miralem Pjanic's cool finish in the box 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.
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.