Three assailants, one with a pistol and two with AK-47 assault rifles, carried out the attack in central Tehran, politician Elias Hazrati told state television.
At the same time ast the parliament attack was launched, a shooting spree and suicide bombing targeted the Ayatollah Khomeini mausoleum about 25 kilometers (15 miles) away, on the southern outskirts of the Iranian capital.
Iran is a predominantly Shiite Muslim country and is at odds with Sunni extremist groups such as al-Qaida and the Islamic State, which it is battling, together with its proxies, in Iraq and Syria.
- There were conflicting reports from inside the Parliament complex, with some reports saying the situation had been brought under control while others said the shooting was continuing, with the buildings under lockdown.
Tasnim news agency said unconfirmed sources on the ground were reporting that seven people including a guard had been killed.
The latest reports indicate that all terrorists who took part in the siege of the parliament building have been killed.
"I stand in solidarity with the President of Iranian Parliament and the Iranian people", European Parliament President Antonio Tajani tweeted. The ISNA news agency said all entrance and exit gates at the parliament were closed and politicians and reporters were ordered to remain inside the chamber.
At least 12 people are dead and several more are injured, according to the BBC.
Khomeini, who died in 1989, is a towering figure in Iran.
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. Already, tensions are high following a cut in ties this week between four Arab countries and Qatar over accusations it supports terrorist groups and is aligning itself too closely with Iran.
One of the four attackers has been arrested, According to Hossein Naghavi Hosseini, Spokesman for the Iranian Parliament's National Security and Foreign Policy Committee.
Reports say the shooting at the Iranian parliament and the mausoleum (south of the parliament) happened simultaneously. Another group of attackers, including a second suicide bomber, struck the shrine.
The last major attack in Iran was in 2010 when a Sunni extremist group carried out a suicide attack against a mosque in Sistan-Baluchistan killing 39 people.
The unusual attacks in Iran's capital, Tehran, prompted the Interior Ministry to call for an urgent security meeting, according to the state-run IRNA news agency.
Ministry of Intelligence has confirmed the two attacks at the Parliament and Imam Khomeini Shrine as terrorist attacks.