13 people were killed in the attacks which were the first Islamic State group attack on Iran, which is fighting IS in Iraq and Syria
Iran's foreign minister on Thursday rejected Donald Trump's condolences for deadly attacks in Tehran, calling the US president's words repugnant.
Trump had said he prayed for the victims of Wednesday's attacks that were claimed by the Islamic State (IS) group, but added that "states that sponsor terrorism risk falling victim to the evil they promote".
Mohammad Javad Zarif wrote on his Twitter account: "Repugnant White House statement .... Iranian people reject such US claims of friendship."
Suicide bombers and gunmen attacked the Iranian parliament and Ayatollah Khomeini's mausoleum in Tehran, killing at least 13 people in an unprecedented assault that Iran's Revolutionary Guards blamed on regional rival Saudi Arabia.
"This terrorist attack happened only a week after the meeting between the US president [Donald Trump] and the [Saudi] backward leaders who support terrorists," said the IRGC in a statement, published by Iranian media.
"The fact that Islamic State has claimed responsibility proves that they were involved in the brutal attack."
IS claimed responsibility and threatened more attacks against Iran's majority Shia population, seen by the hardline Sunni militants as heretics. Saudi Arabia said it was not involved.
A security guard was killed when four gunmen burst into Tehran's parliament complex, while a gardener was reported dead when several armed assailants entered the grounds of Khomeini's mausoleum in the south of the city, according to the ISNA news agency.
"Fighters from Islamic State attacked Khomeini's shrine and the Iranian parliament in Tehran," IS's news agency Amaq said.
An official at Khomeini's mausoleum in south Tehran said "three or four" people had entered via the western entrance and opened fire, killing the gardener and wounding several people, according to the Fars news agency.
Iran's supreme leader, Ayatollah Ali Khamenei, dismissed the attacks as mere "fireworks" that would not weaken the country's fight against terrorism, state TV reported.
"These fireworks have no effect on Iran. They will soon be eliminated...they are too small to affect the will of the Iranian nation and its officials," he said.
Iran's emergency services said a total of 13 people were killed in the two attacks and 43 wounded.
Lawmaker Elias Hazrati told state television three assailants, one with a pistol and two with AK-47 assault rifles, raided parliament.
Parliament was in session as the attacks unfolded, with live footage showing members continuing with routine business even as gun battles were reported in surrounding office buildings.
Speaker Ali Larijani dismissed the attacks, saying they were a "trivial matter" and that security forces were dealing with them.
Intensified gunfire was heard from the neighbouring offices as Fars news agency reported police had launched an assault.
Parliament in session as attacks unfold
Tasmin news agency said there were unconfirmed reports that the attackers had taken four hostages inside the parliament building, but the state news agency IRNA reported that the situation at parliament was under control and a session was going ahead.
Another lawmaker said one of the assailants was surrounded by security forces and all the doors to the building had been closed, ISNA news agency reported.
Members of Iranian forces run during an attack on the Iranian parliament in central Tehran (Reuters)
"I was inside the parliament when shooting happened. Everyone was shocked and scared. I saw two men shooting randomly," said one journalist at the scene, who asked not to be named.
Several Arab media outlets claimed that the Islamic State group carried out the attacks, but removed the news report from their websites after half an hour, according to the semi-offical Fars News Agency.
— Reza Yeganehshakib (@yeganehshakib) June 7, 2017
Around half an hour later and 19 kilometres away from the parliament building, an armed man opened fire at the Mausoleum of Ayatollah Khomeini and wounded a number of people, the semi-official Fars news agency reported.
Ayatollah Ruhollah Khomeini launched the Islamic revolution in 1979.