With nearly three decades of service at the ministry, Afkham has been director of its media and public diplomacy department since 2010, Iranian media reported.
"She is seasoned and experienced in the field of media diplomacy," incumbent spokesman Abbas Araqchi told the ISNA news agency, announcing the appointment.
"Those who have criticism about this will understand that her expertise was the only factor in this appointment," he added in reference to opposition voiced by members of the parliament's ultra-conservative faction.
"We decided to deliver a caution to foreign minister (Mohammad Javad Zarif), so that he appoints a man instead of a woman" as his spokesperson, Hosseini was quoted as saying by the 7 Sobh daily.
More From This Section
Araqchi had said on Tuesday another woman, without naming her, was being groomed to become the Iran's first-ever ambassador.
Afkham's appointment comes as moderate Iranian President Hassan Rowhani has reportedly asked officials to appoint women to high ranking posts.
His cabinet is dominated by men, except for Elham Aminzadeh, who is the vice president for parliamentary affairs.
Although better than those of many regional Arab countries, Iran's laws since the 1979 Islamic revolution have been criticised as unfair to women in matters of marriage, divorce and inheritance.
While women can hold key posts, including in the parliament and the cabinet, they are currently not allowed to stand in presidential elections.
Iran's clergy, which still holds sway in the country, defends the laws, saying they are designed to protect against a Western lifestyle they say takes advantage of women.