President Trump has warned the US is "targeting" 52 Iranian sites and will strike "very fast and very hard" if Tehran attacks Americans or US assets.
The president's remarks followed the US assassination of Qasem Soleimani, a top Iranian general, in a drone strike.
Soleimani's killing was a major escalation between the two nations, and Iran vowed to take "severe revenge".
Writing on Twitter, Mr Trump accused Iran of "talking very boldly about targeting certain USA assets".
He said the US had identified 52 Iranian sites, some "at a very high level & important to Iran & the Iranian culture", and warned they would be "HIT VERY FAST AND HARD" if Tehran struck at the US.
The president said the targets represented 52 Americans who were held hostage in Iran for more than a year from late 1979 after they were taken from the US embassy in Tehran.
Shortly after the president's tweets were posted, the website of a US government agency appeared to have been hacked by a group calling itself "Iran Cyber Security Group Hackers". A message on the American Federal Depository Library Programme site read: "This is a message from the Islamic Republic of Iran.
"We will not stop supporting our friends in the region: the oppressed people of Palestine, the oppressed people of Yemen, the people and the Syrian government, the people and government of Iraq, the oppressed people of Bahrain, the true Mujahideen resistance in Lebanon and Palestine, [they] will always be supported by us."
The web page contained a doctored image of President Trump, depicting him being hit in the face and bleeding at the mouth. "This is only small part of Iran's cyber ability!" read text on the site.
What happened earlier on Saturday?
Mr Trump's tweets followed a huge funeral procession for General Soleimani held in Baghdad, where he was killed in a targeted drone strike on Friday as he left the airport in a convoy. Mourners waved Iraqi and militia flags and chanted "death to America".
Several rocket attacks shook the area shortly after the procession, including one in the Green Zone near the US embassy. The Iraqi military said nobody had been hurt.
No group immediately claimed responsibility for the rocket attacks. Pro-Iranian militants have been blamed for other recent attacks.
Soleimani's body arrived back in Iran on Sunday, the country's IRIB news agency reported.
With Iran already threatening harsh reprisals for the killing of the Quds Force commander, President Trump has clearly determined that the best way to de-escalate is to raise the stakes in advance, making clear what will happen if Tehran follows through on its threats.
The Trump tweet is curious in many ways - not least the symbolic mention of 52 Iranian targets being held at risk - a reference to the 52 US hostages seized in the US Embassy in Tehran back in November 1979.
His mention of targets important "to the Iranian culture" suggests a much wider target list than just leadership, military or economic sites.
President Trump is struggling to establish some kind of deterrence. But the ball is now very clearly in Iran's court and it is very hard to see how Tehran can fail to act.
Mr Trump has pursued a contradictory policy ever since he abandoned the nuclear agreement with Tehran - increasing economic pressure, threatening military action, but actually doing very little, even when Iran shot down a sophisticated US drone and struck oil installations in Saudi Arabia.
Above all, he has repeatedly underscored his and Washington's fatigue with its military involvement in the region. This as much as anything else has undermined US deterrence, something Mr Trump is now seeking, belatedly, to restore.
Why did the US kill Soleimani?
General Soleimani was widely seen as the second most powerful figure in Iran, behind Supreme Leader Ayatollah Ali Khamenei.
The 62-year-old spearheaded Iran's Middle East operations as head of the elite Quds Force, and was hailed as a heroic national figure.
But the US branded the commander and the Quds Force terrorists, holding them responsible for the deaths of hundreds of US personnel.
Speaking on Friday afternoon, President Trump said Soleimani was "plotting imminent and sinister attacks" on US diplomats and military personnel in Iraq and elsewhere in the region.
The general was killed by an air strike at Baghdad airport early on Friday, on the orders of President Trump. The president said the action was taken to stop, not start, a war.
Iran's Ayatollah Khamenei said "severe revenge awaits the criminals" behind the US attack. Soleimani's death would double "resistance" against the US and Israel, he added.
Iraqis are also mourning the death of Abu Mahdi al-Muhandis, an Iraqi who commanded the Iranian-backed Kataib Hezbollah group and was killed along with Soleimani.
The group issued a warning to Iraqi security forces to "stay clear of American bases by a distance not less [than] 1,000m (0.6 miles) starting Sunday evening", al-Mayadeen TV reported.
In response to Iranian threats of revenge, the US has sent 3,000 more troops to the Middle East and advised its citizens to leave Iraq.
On Saturday the White House sent the US Congress formal notification of Friday's drone strike - in line with a 1973 law that states the administration must alert Congress within 48 hours of committing armed forces to immediate or imminent military action.
It was expected to clarify the authority under which the strike was launched, and the expected type and duration of military involvement. The notification is classified.
Nancy Pelosi, the top Congressional Democrat, said it "prompts serious and urgent questions about the timing, manner and justification of the administration's decision to engage in hostilities against Iran".