The semi-official ISNA news agency said all entrance and exit gates at parliament were closed and that lawmakers and reporters were ordered to remain in place inside the chamber.
In the coordinated mid-morning attack, a gardener was reported dead and several more injured when armed assailants entered the grounds of Khomeini's mausoleum in the south of the city.
The SITE intelligence group website said: "The Islamic State (IS) claimed through its 'Amaq News Agency its first attack in Iran, striking the Iranian parliament and the Khomeini shrine in the capital, Tehran".
The Sunni jihadists of IS consider Shiite Iran to be apostates, and Tehran is deeply involved in fighting the group in both Syria and Iraq.
Other reports say the gunmen have opened fire at people while still inside the parliament's courtyard. There, four attackers, including a suicide bomber, killed a security guard and wounded four other people.
Tasmin news agency said there were unconfirmed reports that the attackers had taken four hostages inside the parliament building.
"I was shopping and suddenly heard shooting", said housewife Maryam Saghari, 36, who lives near parliament. Five people died and at least 25 were injured there, Fars reported.
Attacks are highly rare in Tehran and other major cities though a Sunni militant group named Jundallah and its splinter group Ansar al Furqan have been waging a deadly insurgency, mostly in more remote areas, for nearly a decade.
What's new in WatchOS 4?
There are Photos, content from Apple news, coaching reminders from the Activity App, the weather, a reminder from the Breathe app. As well as being customizable, faces can now dynamically change based on various criteria, such as location and time of day.
Trump's visit to Saudi a 'turning point': King Salman
Without naming Pakistan, Trump said "every country must ensure that terrorists do not find any sanctuary on their lands". Drive them out of your community. "Drive them out of your holy land and drive them out of this Earth", he said.
Russians Discussed Potentially 'Derogatory' Info About Trump During Campaign
An Obama administration official told CNN "This was a five-alarm fire from early on, the way the Russians were talking about him". Trump create a flap by lecturing our European allies and refusing to confirm our Article 5 obligations in public.
"Members of a third group were arrested before being able to carry out any attack", the ministry said.
Iran has suffered from terrorist attacks in the past, but rarely in the cities or the capital.
One guard and six others were killed in the incident in parliament early on Wednesday, Tasnim news agency reported.
The attackers chose symbolically significant targets for their assault. The tomb houses the body of Ayatollah Ruhollah Khomeini, the Islamic Republic's founder and first supreme leader, and it is a popular destination for tourists and pilgrims.
Deputy Chairman of Parliament's National Security and Foreign Policy Commission, Abolfazl Hassan Beigi, told Mehr News that terrorists opened fire at people on the street from an open window on the fourth floor.
It also claimed two suicide bombers had blown themselves up at the shrine.
Militant groups are also active in Iran's south-eastern Sistan-Baluchistan province, which borders Pakistan and has a large Sunni community.
- One attacker of Iran Parliament has been arrested, reports state news agency IRNA.