Iranian boats tried to impede a British oil tanker near the Gulf - before being driven off by a Royal Navy ship, the Ministry of Defence has said.
HMS Montrose, a British frigate shadowing the BP-owned tanker, was forced to move between the three boats and the tanker, a spokesman said.
He described the Iranians' actions as "contrary to international law".
Iran had threatened to retaliate for the seizure of one of its own tankers, but denied any attempted seizure.
Last week, British Royal Marines helped the authorities in Gibraltar seize an Iranian tanker because of evidence it was carrying oil to Syria in breach of EU sanctions.
A spokesman for the Royal Gibraltar Police said they had arrested the Indian captain and chief officer of the Iranian tanker on Thursday, on suspicion of breaching EU sanctions, but neither had been charged.
On Wednesday boats believed to belong to Iran's Islamic Revolution Guard Corps (IRGC) approached the British Heritage tanker and tried to bring it to a halt as it was moving out of the Gulf into the Strait of Hormuz.
Guns on HMS Montrose were trained on the Iranian boats as they were ordered to back off, US media reported. The boats heeded the warning and no shots were fired.
The BBC has been told British Heritage was near the island of Abu Musa when it was approached by the Iranian boats.
Although Abu Musa is in disputed territorial waters, HMS Montrose remained in international waters throughout.
Defence Secretary Penny Mordaunt said the government was concerned by the incident and urged the Iranian authorities to "de-escalate the situation".
Foreign Secretary Jeremy Hunt added the UK would monitor the situation "very carefully".
Prime Minister Theresa May's official spokesman said the government was "committed to maintaining freedom of navigation in accordance with international law".
What does Iran say?
The navy of Iran's Islamic Revolution Guard Corps has denied claims it tried to seize the tanker, Iranian news agencies reported. IRGC's navy said there had been no confrontation with any foreign vessels in the past 24 hours.
Iranian foreign minister Mohammad Javad Zarif said the UK made the claims "for creating tension".
"These claims have no value," Mr Zarif added, according to the Fars news agency.
Why are UK-Iran tensions escalating?
The relationship between the UK and Iran has become increasingly strained, after Britain said the Iranian regime was "almost certainly" responsible for the attacks on two oil tankers in June.
Tensions grew after the seizure of an Iranian oil tanker by authorities in Gibraltar, assisted by British Royal Marines.
On Thursday an Iranian official told the BBC the seizure was "unnecessary and non-constructive escalation by the UK".
The official claimed the oil was not bound for Syria and called for the tanker to be released.
The government of Gibraltar said it would not comment on matters relating to the vessel as it was the subject of a police investigation. It said the matter was also now in the Supreme Court.
The Port of Gibraltar's live map showed the tanker, Grace 1, remained anchored about 3km off the east coast of Gibraltar.
At the time of the Gibraltar incident, Iran summoned the British ambassador in Tehran to complain about what it said was a "form of piracy".
An Iranian official said a British oil tanker should be seized if Grace 1 was not released.
On Wednesday, Iranian President Hassan Rouhani mocked the UK, calling it "scared" and "hopeless" for using Royal Navy warships to shadow another British tanker in the Gulf.
HMS Montrose had shadowed the British tanker Pacific Voyager for some of the way through the Strait of Hormuz, but that journey had passed without incident.
"You, Britain, are the initiator of insecurity and you will realise the consequences later," Mr Rouhani said.
The UK has also been pressing Iran to release British-Iranian mother Nazanin Zaghari-Ratcliffe who was jailed for five years in 2016 after being convicted for spying, which she denies.
The Royal Navy has a frigate, four minehunters and a Royal Fleet Auxiliary support ship already stationed in a permanent Naval Support Facility in the region, at Mina Salman in Bahrain.
This is enough to provide reassurance, but probably not to deal with a crisis, BBC defence correspondent Jonathan Beale said.
"HMS Montrose will not be able to provide protection for every commercial vessel in the Gulf with links to the UK," he added.
"Ministers will now have to contemplate sending another Royal Navy warship to the region. But in doing so, that may only further escalate tensions with Iran, which is something the government wants to avoid."
The Ministry of Defence confirmed Royal Marines were on board HMS Montrose and said this was normal for frigates and destroyers deployed to the Gulf.
Can ships in the area avoid Iranian waters?
The Strait of Hormuz, through which all ships must pass to enter the Gulf, is so narrow - just 21 nautical miles (39km) at its narrowest - that Iranian and Omani territorial waters meet in the middle.
So instead of sailing through international waters, ships must pass through Iranian or Omani territory which both extend 12 nautical miles out from their coasts.
Ships do this under something called Rights of Straits Passage - part of a UN convention which gives ships free passage through the world's chokepoints like the Strait of Gibraltar and the Malacca Strait.
In the case of the Strait of Hormuz, shipping is channelled through two lanes heading in opposite directions, each one two nautical miles wide.
This is called the Traffic Separation Scheme.
Both Iran and the US Navy deploy warships to patrol this area and have narrowly avoided confrontation on several occasions.
Once ships pass through the Strait of Hormuz and enter the Gulf they need to be wary of a contested area around the islands of Abu Musa and the Greater and Lesser Tunbs.
These are claimed by both Iran and the UAE but occupied solely by Iranian forces.
Could the UK-Iran situation get worse?
Iran appears to have been attempting to make good on its threat against British-flagged vessels in the wake of the seizure of an Iranian tanker off Gibraltar.
But though this incident has a specifically bilateral dimension, it is also a powerful reminder that the tensions in the Gulf have not gone away.
And with every sign that the dispute over the nuclear agreement with Iran is set to continue, things may only get worse.
The episode may add some impetus to US-brokered efforts to muster an international naval force in the Gulf to protect international shipping.
But most worrying of all, it shows that elements within the Iranian system - the Revolutionary Guard Corps's naval arm, or whatever - are intent on stoking the pressure.
This inevitably plays into President Trump's hands as Britain and its key European partners struggle to keep the nuclear agreement alive.
What we know about British Heritage
It is understood British Heritage was not carrying cargo at the time of the incident with the Iranian boats.
A spokesman for BP said: "Our top priority is the safety and security of our crews and vessels.
"While we are not commenting on these events, we thank the Royal Navy for their support."
The vessel is registered at the port of Douglas, in the Isle of Man.
What are US-Iran tensions about?
The US has blamed Iran for attacks on six oil tankers in May and June.
On Wednesday the chairman of the US military's Joint Chiefs of Staff said it wanted to create a multi-national military coalition to safeguard waters around Iran and Yemen.
The news followed the Trump administration's decision to pull out of an international agreement on Tehran's nuclear programme and reinforce punishing sanctions against Iran.
European allies to the US, including the UK, have not followed suit.
Iran's ambassador to the UN has insisted Europeans must do more to compensate Tehran for economic losses inflicted by US sanctions.
Tehran has begun to nudge the levels of its enriched uranium beyond the limits of a nuclear deal agreed with a group of world powers, in small and calculated steps.
Majid Takht-Ravanchi told the BBC, Iran would move to the "third phase" of its stepped-up uranium enrichment programme unless the Europeans kept promises to uphold the economic benefits of the accord.