In 2015, under then-president Barack Obama, the USA and Iran reached a landmark nuclear deal - also signed by China, Russia, the UK, France and Germany - where Iran limited its nuclear activities in exchange for sanctions relief.
State television said the assault, which wounded more than 60 people, targeted a stand where Iranian officials had gathered in the city of Ahvaz to watch an annual event marking the start of the Islamic Republic's 1980-88 war with Iraq.
Ahvaz lies in Khuzestan, a province bordering Iraq that has a large ethnic Arab community and has seen separatist violence in the past that Iran has blamed on its regional rivals. The group provided no evidence for the claim, Reuters reported.
IRNA reported civilians, including women and children, who were watching the parade in the southwestern city Ahvaz, are among the dead and injured.
Three attackers were killed at the scene and the fourth died later of his injuries, said armed forces spokesman Brigadier General Abolfazl Shekarchi. "I saw a four-year old child get shot, and also a lady", he said.
IS has carried out a major attack in Iran before. However, Arab separatist groups in the region have launched attacks on oil pipelines there in the past and Iran.
The IRNA report, which said the death toll was expected to rise, did not say whether members of Iran's elite Islamic Revolutionary Guards Corps (IRGC) were among the fatalities.
Iran has intervened in the wars in Syria and Iraq and plays an influential role in Yemen, but this was a rare attack on its own soil.
Videos on social media show soldiers in uniform and civilians dropping to the pavement and running for cover, as gunfire rings out in the background. Other armed security personnel shouted at each other in front of what appeared to be a viewing stand. Another responded: "From behind us".
State television blamed "takfiri elements", a reference to Sunni fighters, for the attack.
"They have been trained and organized in two Persian Gulf countries", he said, without elaborating.
In the Gulf, the United Arab Emirates or Bahrain are all close U.S. military allies.
Khuzestan deputy governor Ali-Hossein Hosseinzadeh told the semi-official ISNA news agency that "eight to nine" troops were among those killed, as well as a journalist.
Trump and Rouhani will both be in NY next week for the United Nations General Assembly.
Rouhani ordered Iranian intelligence agencies to arrest the perpetrators behind the attack.
"I would like to confirm our readiness to further enhance cooperation with our Iranian partners in the fight against this evil", he said.
Yahya Rahim Safavi, a senior Iranian Revolutionary Guards official, has vowed retaliation for the attack.
President Vladimir Putin said on Saturday that Russian Federation is ready to help Iran fight terrorism.
Rouhani, who engineered Iran's 2015 nuclear deal that ushered in a cautious detente with Washington before tensions resurged with President Donald Trump's decision in May to quit the accord, said: "America is acting like a bully towards the rest of the world.and thinks it can act based on brute force".
Yacoub Hor al-Tostari, a spokesman for the Arab Struggle Movement to Liberate Ahvaz, told The Associated Press that members of an umbrella group of Ahvazi activists his organization leads carried out the attack.