The coach César Irache Camacho scored 38 points for Spain, while Mohammadamin Rahimi led Iran with 20 points.
Poland and France will compete in the final later today, Tehran Times reported.
The tournament began on July 24 in Tashkent, Uzbekistan, and will conclude on Aug. 3.
Iran are one of the most successful teams in the history of the competition, having secured two gold medals, three silver, and three bronze medals. Brazil and Russia have claimed six and three gold medals, respectively.
MNA