Rayan gave the Brazilian team the lead in the 28th minute at Jakarta International Stadium.
Iran’s Abolfazl Zamani scored an own goal in the first half’s injury time.
Yaghoob Barajeh pulled a goal back in the 54th minute and Kasra Taheri leveled the score in the 69th minute. Four minutes later, Esmaeil Gholizadeh made it 3-2.
Earlier in the day, England defeated New Caledonia 10-0 in the same group.
Iran are scheduled to meet England, and New Caledonia on Tuesday and Friday, respectively.