European governments have agreed in principle to impose a ban on imports of oil from Iran, a potentially serious blow to the already unsteady Iranian economy and a significant escalation in the international pressure on the Tehran government.

Negotiations on a European oil embargo on Iran have been under way since an EU foreign ministers meeting last month. On Wednesday night a European diplomat said there was now a consensus that the ban on crude imports would be applied, but that there was still debate on the timing and duration of the measures.

"There is agreement in principle on Iranian oil imports," the diplomat said. "What is now being discussed is what exceptions there would be for existing contracts and what kind of review clause there will be."

The formal agreement on the measures is due to be finalised by the next EU foreign ministers meeting on 30 January, but the sanctions will probably not take effect immediately. One diplomat said they could come into force at the same time as US financial sanctions aimed at international banks financing Iranian crude oil sales.

Europe is the second-biggest customer for Iranian crude after China, buying about 450,000 barrels out of a total of 2.6m barrels a day the country exports.

Iran has shrugged off the threat, saying it can find new customers, but it will almost certainly have to sell its output at a discount to its remaining and new buyers.

Tehran has also warned that the measures would raise tensions in the Middle East, and has threatened to close the Strait of Hormuz – the narrowest point in the Gulf – to tanker traffic in response to any oil sanctions.

The Iranian army commander, Ataollah Salehi, also warned a US aircraft carrier, which had left the region during Iranian naval exercises, not to return. Salehi added: "We are not in the habit of warning more than once."

Western capitals have played down the threats, arguing that closing the Strait of Hormuz would be suicidal for the Iranian economy, and US naval commanders said they would continue to patrol the area to ensure the waterway remained open to commerce.

A European dismissed the Iranian threats as "bluster" and argued that sanctions are having an effect in making Tehran rethink its defiance of UN security council resolutions demanding it suspend enrichment of uranium.

"They are sabre-rattling, but at the same time they are talking about reopening engagement on the nuclear file, so it does seem that they are rattled and sanctions are having an impact," the diplomat said. "We now see how concretely and on what basis they are going to engage."