The Islamic States (IS) group on Saturday claimed responsibility for the open gunfire at a military parade near the Iraqi border, killing at least 29 people.
Iranian President Hassan Rouhani swore a “crushing” against IS group.
Iran summoned diplomats from Denmark, the Netherlands and Britain over their "hosting of some members of the terrorist group" who are responsible for carrying out the attack.
The Islamic State (IS) group claimed responsibility for the rare assault in the southwestern city of Ahvaz, while Iranian officials blamed "a foreign regime" backed by the US.
A local journalist who witnessed the attack said shots rang out for 10 to 15 minutes and that at least one of the assailants, armed with a Kalashnikov assault rifle, wore the uniform of Iran's Revolutionary Guards.
"We realised it was a terrorist attack as bodyguards (of officials) started shooting," Behrad Ghasemi told AFP. "Everything went haywire and soldiers started running. The terrorists had no particular target and didn't really seem to care as they shot anyone they could with rapid gunfire."
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.
"It is not acceptable that the European Union does not blacklist members of these terrorist groups as long as they do not perpetrate a crime on... European soil," official news agency IRNA quoted foreign ministry spokesman Bahram Qasemi as saying.
After addressing a similar parade in Tehran to commemorate the start of the 1980-1988 war with Iraq, Rouhani warned that "the response of the Islamic Republic of Iran to the smallest threat will be crushing".
Foreign Minister Mohammad Javad Zarif said the attack was carried out by "terrorists recruited, trained, armed & paid by a foreign regime".
"Iran holds regional terror sponsors and their US masters accountable for such attacks," he wrote on Twitter.
IS claimed the attack via its propaganda mouthpiece Amaq and, according to intelligence monitor SITE, said the attack was in response to Iranian involvement in conflicts across the region.
State television gave a toll of 29 dead and 57 wounded, while IRNA said those killed included women and children who were spectators at the parade.
Three attackers were killed at the scene and the fourth died later of his injuries, said armed forces spokesman Brigadier General Abolfazl Shekarchi.
The Revolutionary Guards accused Shiite-dominated Iran's Sunni arch-rival Saudi Arabia of funding the attackers, while Iran's supreme leader Ayatollah Ali Khamenei also blamed Iran's pro-US rivals.
Tehran-backed Lebanese Shiite movement Hezbollah condemned the "terrorist" attack, saying that "repulsive Satanic hands" were behind it.
"This operation was a continuation of the other forms of war the United States and its allies are waging, directly or indirectly," it said.
In a message to Russia's close regional ally, President Vladimir Putin said he was "appalled by this bloody crime", while Syria, another ally, neighbouring Turkey and France also expressed condolences.
Khuzestan was a major battleground of the 1980s war with Iraq and the province saw unrest in 2005 and 2011, but has since been largely quiet.
Kurdish rebels frequently attack military patrols on the border further north, but attacks on regime targets in major cities are rare.
On June 7, 2017 in Tehran, 17 people were killed and dozens wounded in simultaneous attacks on the parliament and on the tomb of revolutionary leader Ayatollah Ruhollah Khomeini -- the first inside Iran claimed by IS.
In April, 26 alleged members of the Sunni extremist group went on trial in connection with the attacks.
The attack in Ahvaz came as Rouhani and other dignitaries attended the main anniversary parade in Tehran.
In a keynote speech, he vowed to boost Iran's ballistic missile capabilities, despite Western concerns that were cited by his US counterpart Donald Trump in May when he abandoned a landmark nuclear deal with Tehran.
"We will never decrease our defensive capabilities... we will increase them day by day," Rouhani said.
"The fact that the missiles anger (the West) shows they are our most effective weapons."
The United States reimposed crippling sanctions on Iran last month, and another round of even harsher sanctions targeting Iran's vital oil sector is set to go back into effect on November 5.
Washington has said it is ready to open talks on a new agreement to replace the July 2015 accord, but Tehran has repeatedly said it cannot negotiate under pressure from sanctions.
Rouhani leaves Sunday for New York to attend next week's United Nations General Assembly along with Trump, but Iran has repeatedly ruled out any meeting.