Iran's Foreign Minister Mohammad Javad Zarif has said he is stepping down, in a surprise announcement posted to his Instagram account.
He apologised for "shortcomings" during his time in government.
Mr Zarif played a prominent role in negotiating the landmark 2015 nuclear agreement between Iran and major international powers.
But the future of the deal has been put into doubt after US President Donald Trump ended US involvement.
Mr Zarif's resignation was confirmed by Iran's state-run news agency, Irna, which cited a spokesman for the foreign ministry.
The 59-year-old was educated in the US and holds a PhD in international law from the University of Denver.
He has served as Iran's ambassador to the UN and became foreign minister in 2013 after President Hassan Rouhani was elected promising a more moderate, outward-looking Iran.
Is it a tactic?
By Lyse Doucet, Chief International correspondent
A cloud of speculation hangs over Javad Zarif's sudden resignation. It's not clear if President Rouhani will want to accept his departure at a time when Iran faces major challenges on every front. That decision lies with Iran's supreme leader, Ayatollah Khamenei.
Mr Zarif, a leading architect of Iran's landmark nuclear accord, has been spearheading diplomatic efforts to save it as new sanctions cause growing economic hardship. But he's under huge pressure from hardliners who never liked or trusted his negotiations with the West.
There are reports Mr Zarif's move was finally triggered by his exclusion from the visit to Tehran of Syria's President Assad. Is Mr Zarif's resignation a tactic? Or is this the exit of the US-educated diplomat who became the smiling face of Iran's new engagement with the world?
Some observers believe Tehran's foreign policy will start hardening in the face of a concerted campaign by Washington and its allies which Mr Zarif described, in a defiant interview last week in Munich, as all about regime change.
Why has he quit?
It is far from clear. His post on Instagram thanked the Iranian people and authorities but gave no reason for the resignation.
"I apologise for not being able to continue in the post and for all the shortcomings and flaws in the period," he wrote.
Unlike other major social media networks, Instagram is not blocked in Iran.
It is not clear if his resignation will be accepted by President Rouhani, although the president's chief-of-staff tweeted to deny reports it had been accepted.
Mr Zarif has been under pressure at home from hardliners since the US withdrew from the Iranian nuclear pact, which binds Iran to limit its nuclear activities.
On Monday Syrian President Bashar al-Assad met Iran's supreme leader Ayatollah Ali Khamenei in the capital, Tehran, but analysts noticed that Mr Zarif did not attend discussions.
Iran has been one of the Syrian government's main backers during its civil war. Apart from Russia, this trip to Tehran is thought to be Mr Assad's first foreign visit since the start of the war in 2011.
Where does this leave the nuclear deal?
The 2015 pact was was agreed by Iran, the US, the UK, France, China, Russia and Germany, and saw Iran limit its nuclear activities in exchange for sanctions relief.
But President Trump called the deal "horrible" and argued it did not do enough to rein in Iranian nuclear activity or curb its actions abroad, such as in Syria.
Last year he announced the US was pulling out of the deal and re-imposed sanctions.
The other signatories in the agreement have vowed to continue and Mr Zarif had been spearheading efforts to keep it alive.
Iran insists its nuclear programme is entirely peaceful. Its compliance with the deal has been verified by the International Atomic Energy Agency (IAEA), which has said Iran is honouring its commitments.
Iran is one of the world's largest oil producers, with exports worth billions of dollars each year. Its economy has been under strain and the country has seen large-scale protests over rising prices and a decline in the value of its currency, the rial.
Reacting to Mr Zarif's announcement, US Secretary of State Mike Pompeo said on Twitter the Trump administration's policy towards Iran would remain "unchanged".
We note @JZarif’s resignation. We’ll see if it sticks. Either way, he and @HassanRouhani are just front men for a corrupt religious mafia. We know @khamenei_ir makes all final decisions. Our policy is unchanged—the regime must behave like a normal country and respect its people.— Secretary Pompeo (@SecPompeo) February 26, 2019