Dozens of people were wounded in the attacks, which ended after a standoff lasting several hours as the gunmen holed up in parliamentary office buildings.
IS released a video of the attackers from inside the building via its Amaq propaganda agency -- a rare claim of responsibility while an attack was still going on.
Police said all the attackers had been killed by around 3 PM (1030 GMT), some five hours after it started.
The assaults began mid-morning when four gunmen burst into the parliament complex in the centre of Tehran, killing a security guard and one other person, according to the ISNA news agency.
An interior ministry official said they were dressed as women and entered through the visitors' entrance.
At roughly the same time, a team of three or four assailants entered the grounds of the mausoleum of Ayatollah Ruhollah Khomeini, who led the 1979 Islamic revolution, killing a gardener and wounding several other people.
Two of the attackers at the shrine, one of them a woman, blew themselves up, while another detonated a suicide vest on the fourth floor of the parliamentary office building.
A picture on social media showed police helping staff escape through windows.
Large crowds gathered around cordons to watch as police struggled to disperse the crowds.
Parliament was in session as the attacks unfolded and members were keen to show they were undeterred, continuing with regular business.
Some posted selfies of themselves looking calm, even as gun battles raged in surrounding office buildings and snipers took position on nearby rooftops.
An official at Khomeini's mausoleum in south Tehran said "three or four" people had entered via the western entrance and opened fire, according to the Fars news agency.
It published photos showing the suicide bomber blowing herself up outside.
The intelligence ministry said there had been a third "terrorist" team that was neutralised before the attacks started.
The city was on lockdown, with streets blocked and parts of the metro closed. Journalists were kept away from the shrine by police.
Jihadist groups have clashed frequently with security forces along Iran's borders with Iraq and Afghanistan, but the country has largely escaped attacks within its urban centres.
The intelligence ministry said in June 2016 that it had foiled a plot to carry out multiple bomb attacks in Tehran and around the country.
IS published a rare video in Persian in March, warning that it "will conquer Iran and restore it to the Sunni Muslim nation as it was before."
Iran, the predominant Shiite power, has been helping both Iraq and President Bashar al-Assad's regime in Syria to battle IS.
Militant groups are also known to operate in Iran's southeastern Sistan-Baluchistan province, which borders Pakistan and has a large Sunni community.
Jaish-ul Adl (Army of Justice), which Tehran accuses of links with Al-Qaeda, has carried out several armed attacks on Iranian soil in recent years.
Iran's supreme leader Ayatollah Ali Khamenei said on Sunday that attacks by IS in Europe and elsewhere showed that Western policies in the Middle East have backfired.
Disclaimer: No Business Standard Journalist was involved in creation of this content
