Alireza Akbari, who had dual citizenship in the UK and Iran, was put to death after being given that country's death penalty.
Mr. Akbari's family was asked to make a "final visit" on Wednesday, and his wife reported that he had been placed in solitary confinement.
Despite his protests, the former Iranian deputy defense minister was arrested in 2019 and convicted of spying for the UK.
UK Prime Minister Rishi Sunak described the death as "a cruel and despicable murder, carried out by a savage regime."
Mr. Sunak said that Alireza's friends and family were in his thoughts and that the Iranian authorities "had no concern for the human rights of their people."
The UK's foreign secretary, James Cleverly, predicted that the execution "would not go unchallenged."
Iran called the British ambassador to Tehran due to its "unconventional efforts."
The Iranian court's official news outlet, Mizan, reported on Saturday that Alireza Akbari had been hanged but did not provide a specific date for the execution.
The information was made public after the British-Iranian was described by Iran's intelligence ministry as "one of the most important operatives of the British intelligence agency in Iran" and after the country earlier this week aired a video of Mr. Akbari that was said to show confessions obtained under duress.
However, Mr. Akbari said that he had been tortured and forced to confess to crimes he had not done in an audio message that was broadcast on BBC Persian on Wednesday.
The US has added its voice to calls for Iran to forgo executing Mr. Akbari. The individual is accused of being politically motivated, according to US ambassador Vedant Patel, who also said that "his death would be unthinkable."
Human rights group Amnesty International asked the UK to investigate claims that Mr. Akbari was tortured before his death.
France summoned Iran's top diplomat to Paris as Mr. Akbari was being executed, and the foreign ministry of that nation warned that Iran's "repeated violations of international law cannot go unpunished."
The Iranian regime would use Mr. Akbari's passing to suggest that a "heavy outside hand" was igniting the unrest against the government and link the protests to the accusation that Western nations were attempting to "destabilize the Islamic republic," according to Dr. Sanam Vakil, a Chatham House think tank researcher on Iran.
"Maintaining the narrative of the West being involved is a method to sustain unity among the political class," she remarked on BBC Radio 4's Today program.
The UK Foreign Office has repeatedly brought up Mr. Akbari's problem with Iranian authorities while advocating on behalf of Mr. Akbari's family. Despite its urgent need for consular access, the Iranian government does not accept dual nationality for Iranians.
Mr. Akbari left a voicemail saying that a top Iranian official who was involved in nuclear talks with other nations invited him to travel to Iran a few years ago when he was abroad.
To obtain top-secret intelligence, he was instructed to purchase a bottle of perfume and a shirt from Ali Shamkhani, the secretary of Iran's Supreme National Security Council, when he arrived, the man says.
Mr. Akbari said that he was interrogated and subjected to torture for "more than 3,500 hours."
He said that "Medical and psychological methods "destroyed my will, drove me nuts, and forced me to do everything they wanted."
"They used a firearm and the threat of death to coerce me into admitting to making false and fraudulent allegations."
He further said that Iran planned to have him executed "to inflict revenge on the UK."
The Mizan news agency revealed for the first time, hours after the audio message was played, that the Supreme Court denied Mr. Akbari's appeal after the court found him guilty of espionage.
Relations between the two nations have been worse ever since the UK imposed sanctions on Iran's morality police and other top security officials in response to that country's violent crackdown on anti-government demonstrators.
Numerous Iranians who hold a second nationality or permanent residency abroad have been imprisoned by Iran in recent years, most often on suspicion of espionage and threats to national security.
British-Iranian nationals Nazanin Zaghari-Ratcliffe and Anoosheh Ashoori were released and permitted to leave Iran after the UK paid off an old debt owed to Iran.
However, Morad Tahbaz, a US citizen, and at least two other British Iranians are still detained.