In their final group engagement at the Jawaharlal Nehru Stadium, the Asian nation scored through Mohammed Ghobeishavi (25th minute), Taha Shariati (29th) and Mohammad Sardari (89th) to top the group with nine points from three matches.
Germany, who beat Guinea 3-1 at Kochi in the other match of the day, finished second with six points, and will now travel to Delhi to play against Colombia in the knockout round.
Costa Rica and Guinea finished the group stage with one point each.
While Iran, who topped this group, stay in Goa and will play against one of the third best teams from either Group A, B or F on October 17.
Keen to top the group, Asian powerhouse Iran employed five defenders and kept the rival attackers at bay, while finding the back of the net on three occasions.
After brief period of midfield battle, Iran slowly opened up the rival defence with raids from the flanks and Costa Rica started feeling panicky, conceded two penalty in a span of four minutes.
Amferny Arias, while going for an aerial ball, brought down Younes Delfi inside the box and referee Hamada Nampiandraza awarded the spot kick, which Iran captain Ghobeishavi converted by sending the ball to the bottom right corner.
Under tremendous pressure in the face of Irani offensive, Costa Rica again conceded a penalty when defender Karin Arce needlessly pushed down Younes Delfi while going for an aerial ball inside the box. On this occasion, defender Shariati had no problem convented it.
Costa Rica, who needed a win to keep themselves in fray for the knockouts, found the going tough and were not allowed space by the Iranian defenders.
After the break, Costa Rica coach Breansse Camacho brought his trump card Jose Alfaro in the hope of changing their fortunes, but to no avail.
Iran, who held the midfield superiority, rounded off the tally through Sardari's strike off a through ball by Airhossein Hosseinzadeh.