Iran's dreams of a place in the last 16 of the World Cup were ended by goals from Manchester City striker Edin Dzeko, Miralem Pjanic and Avdija Vrsajevic as Bosnia-Herzegovina's tournament ended with a 3-1 win.
The Europeans had already made history in reaching the World Cup for the first time in their country's short existence while Iran, who had won just one of 11 previous games at the tournament, were looking to set their own landmark by making it through to the knockout stage.
Group F winners Argentina kept their side of the bargain by beating Nigeria but Iran never looked like securing the victory they needed to progress and Reza Ghoochannejhad's late consolation was immediately followed by Bosnia's third from Vrsajevic - a first for his country.
Dzeko looked lively early on so it was no surprise when he opened the scoring after 23 minutes.
Iran's solid defence against Argentina had won plaudits even in defeat to a late Lionel Messi goal but with victory imperative in Salvador they left themselves a lot more open and Bosnia had no trouble exposing them.
Pjanic was given plenty of time to pick out Dzeko, himself afforded too much space, and the Manchester City striker set off on a diagonal run from right to left before shooting past Alireza Haghighi from 25 yards.
Iran almost produced the perfect immediate response with Masoud Shojaei's shot cannoning back off the crossbar with Stoke goalkeeper Asmir Begovic beaten but Ghoochannejhad was thankful an offside flag meant his botched attempt to convert the rebound was irrelevant.
Bosnia retained a degree of control and late in the half right-back Vrsajevic scuffed a shot wide of the far post with Vedad Ibisevic visibly annoyed he did not cross to him just outside the six-yard box.
Their second - which finally put paid to Iran's chances - just short of the hour was self-inflicted as Jalal Hosseini gave away possession in his own half and was severely punished as Tino Susic provided the pass for Pjanic, who was borderline offside, to slide home.
Ghoochannejhad struck with eight minutes to go but there was not even time for Iran to consider an unlikely comeback before Vrsajevic drilled home Bosnia's third from a narrow angle.