Iran is ready to destroy any country that launches an attack on its territory, a senior military official says.
The commander of Iran's Revolutionary Guards warned the US and its allies to "be careful and make no mistake."
The comments came shortly after the US announced it was sending troops to support Iran's rival, Saudi Arabia.
The US and Saudi Arabia have blamed Iran for recent attacks on two Saudi oil facilities.
Iran has denied that it was involved in the attacks. Yemen's Houthi rebels, who are backed by Iran, have said they were responsible.
Tensions between the US and Iran have escalated since US President Donald Trump abandoned a deal limiting Iran's nuclear activities and reinstated sanctions.
What did Iran say?
"Our readiness to respond to any aggression is definitive," Maj-Gen Hossein Salami told state media on Saturday. "We will never allow a war to enter our land."
"We will pursue any aggressor," he continued. "We will continue until the full destruction of any aggressor."
Maj-Gen Salami, who was speaking at the opening of an exhibition of captured drones in the capital, Tehran, added that "they will hit anybody who crosses" Iranian borders.
Iran's Revolutionary Guard Corps (IRGC) are an elite branch of the country's military and have been designated a terrorist organisation by the US.
What about the US?
The US decision to send troops to Saudi Arabia was "defensive in nature", Defence Secretary Mark Esper told reporters on Friday.
He said Saudi Arabia and the United Arab Emirates had requested military assistance, adding that the total number of troops who will be sent is yet to be decided.
The US forces would focus on boosting air and missile defences and would "accelerate the delivery of military equipment" to both nations, Mr Esper added.
Later on Friday, President Trump announced new sanctions against Iran while signalling that he wanted to avoid military conflict. The fresh sanctions, which Mr Trump described as "highest level", will focus on Iran's central bank and its sovereign wealth fund.
But he struck a more conciliatory tone in comments made in the Oval Office. "I think the strong person approach, and the thing that does show strength, would be showing a little bit of restraint," he said.
A game of brinkmanship
Analysis by Sebastian Usher, BBC Arab Affairs Editor
Iranian officials - both political and military - have issued a series of fierce warnings about any potential attack on their territory.
The US has adopted a less confrontational tone, but has continued with the Trump administration's policy of applying maximum pressure.
New sanctions targeting Iran's national bank and the mobilisation of more US troops in the Gulf are all part of this strategy.
What seems clear is that this remains a game of brinkmanship, with all sides still hoping to be able to pull back from a direct military confrontation.
But the pattern of dangerous escalation over recent weeks does not bode well for this strategy.
What happened in Saudi Arabia?
Strikes hit the Abqaiq oil facility and the Khurais oil field in Saudi Arabia a week ago, affecting the global oil supply.
On Wednesday, the kingdom's defence ministry showed off what it said were the remains of drones and cruise missiles proving Iranian involvement. The country was still "working to know exactly the launch point", a spokesman said.
The US has also said Iran was responsible. Senior officials have told US media outlets they had evidence the attacks originated in the south of Iran.
Iran has repeatedly denied any role in the strikes, with President Hassan Rouhani calling the attacks a reciprocal act by the "Yemeni people".
On Wednesday, Secretary of State Mike Pompeo called the strikes "an act of war".
Mr Zarif warned on Twitter that Iran had no desire for war but "we will not hesitate to defend ourselves".
Meanwhile, the Saudi state oil company, Aramco, said it expects oil output to return to pre-attack levels by the end of September.
What's the background to all this?
The Houthis have repeatedly launched rockets, missiles and drones at populated areas in Saudi Arabia. They are in conflict with a Saudi-led coalition which backs a president who the rebels had forced to flee when the Yemeni conflict escalated in March 2015.
Iran is the regional rival of Saudi Arabia and an opponent of the US, which pulled out of a treaty aimed at limiting Tehran's nuclear programme after Mr Trump took power.
US-Iran tensions have risen markedly this year.
The US said Iran was behind attacks on two oil tankers in the Gulf in June and July, as well as on another four in May. Tehran rejected the accusations in both cases.
BDST: 1956 HRS, SEP 21, 2019