Trump's tweet followed Iranian President Hassan Rouhani cautioning the American leader on Sunday about pursuing hostile policies against Tehran, saying: "War with Iran is the mother of all wars."
"You are not in a position to incite the Iranian nation against Iran's security and interests," the Iranian leader said, in an apparent reference to reports of efforts by Washington to destabilize Iran's Islamic government. Still, Rouhani did not rule out peace between the two countries.
The heated exchange comes as tension between the two nations has increased since Trump pulled the U.S. out of a nuclear deal with Iran that was struck during the Obama administration.
Monday morning, Trump's hawkish national security advisor, John Bolton, backed the president's threat. “I spoke to the President over the last several days, and President Trump told me that if Iran does anything at all to the negative, they will pay a price like few countries have ever paid before," Bolton said in a statement released by the White House.
Before Trump tweeted his threat, Secretary of State Mike Pompeo had launched a rhetorical assault on Iran's leaders on Sunday, comparing them to a "mafia" and promising unspecified backing for Iranians unhappy with their government.
Pompeo, in a California speech to a largely Iranian-American audience, dismissed Rouhani and Foreign Minister Mohammad Javad Zarif, who negotiated the 2015 nuclear deal with the United States and other countries, as "merely polished front men for the ayatollahs' international con artistry."
Trump withdrew the U.S. from the accord, which was intended to stop Iran from developing nuclear weapons, in May. In doing so, he triggered a 180-day countdown clock for Pompeo and Treasury Secretary Steven Mnuchin to restore the punitive sanctions on Iran that the nuclear deal had eased.
In response to the threat of renewed sanctions on its exports, Iran suggested in July that it could leverage its position along the important trade route, the Strait of Hormuz, to stop other Middle Eastern countries from shipping their barrels to the world.
Even before he became president, Trump repeatedly characterized the agreement, which had been brokered under the Obama administration, as one of the "worst deals" the U.S. had ever negotiated.
Trump's all-caps warning to Rouhani in the Sunday night tweet has also drawn parallels to his approach when dealing with another hostile foreign leader: North Korea's Kim Jong Un.
In a public display of rhetorical brinkmanship, Trump and Kim traded increasingly heated threats at the beginning of 2018. Trump had bragged that his nuclear button was bigger and more powerful than Kim's, and had threatened the North Korean leader with "fire and fury" if he continued to challenge the United States.
—Reuters contributed to this report.