Three Iranian boats tried to stop a British oil tanker in the Strait of Hormuz, the Ministry of Defence has said.
The boats withdrew after a warning from a British warship - HMS Montrose - operating in the area.
In a statement, the UK government said it was "concerned" by the incident and urged Iranian authorities "to de-escalate the situation in the region".
A government spokesman said: "Contrary to international law, three Iranian vessels attempted to impede the passage of a commercial vessel, British Heritage, through the Strait of Hormuz.
"HMS Montrose was forced to position herself between the Iranian vessels and British Heritage and issue verbal warnings to the Iranian vessels, which then turned away.
"We are concerned by this action and continue to urge the Iranian authorities to de-escalate the situation in the region."
However, Iran's Revolutionary Guard denied claims of a confrontation, saying if it had received orders to seize any ships it would have executed them immediately.
A statement from the guard's navy said "there were no clashes with alien boats, especially English boats".
Initial reports from US officials suggested that five Iranian vessels were involved in the incident.
"The Royal Navy HMS Montrose, which was also there, pointed its guns at the boats and warned them over radio, at which point they dispersed," one of the officials said.
"It was harassment and an attempt to interfere with the passage," another official said.
The incident comes as the HMS Montrose warship was said to be offering extra protection to British Heritage in the Gulf following a threat from Iran to seize a British vessel.
Tensions have been rising since Royal Marines helped seize an Iranian-flagged tanker in Gibraltar which was allegedly carrying oil to Syria, in breach of European Union sanctions.
:: Listen to the Daily podcast on Apple Podcasts , Google Podcasts , Spotify , Spreaker
The capture of the Grace 1 tanker prompted Iranian President Hassan Rouhani to warn the UK of "consequences".
"You (Britain) are the initiator of insecurity and you will realise the consequences later," Rouhani said after a cabinet meeting on Wednesday, according to the semi-official news agency Tasnim.
Brigadier General Amir Hatami also warned the UK its actions "will not go without a response".
Tehran claimed the detention was an "illegal interception" and have demanded the tanker's release.
But Gibraltar officials believe the 330m (1,000ft) tanker could have been carrying up to two million barrels of oil destined for Syria.
Iran has denied this and said the boat was headed "somewhere else".
Gibraltar's supreme court ruled last week the tanker could be held for another 14 days, the territory's attorney general said.
The US has been leading a push for allies and other tankers that use the Strait of Hormuz to increase their maritime security in the region, safeguarding strategic waters off Iran and Yemen.
It alleges that Tehran was behind attacks on six oil tankers in the area.
Relations between the two countries have fractured since President Donald Trump pulled the US out of a nuclear deal with Iran and re-imposed sanctions.