Iran agreed Wednesday to allow a UN watchdog the access it has requested to two alleged nuclear sites, as the head of the agency ended his first visit to Tehran.
The announcement came only hours after Iran's arch foe the United States suffered a humiliating defeat when the United Nations blocked its controversial bid to reimpose international sanctions on the Islamic republic.
The US move had threatened to torpedo a historic 2015 accord under which Iran had agreed to curb its nuclear programme in exchange for sanctions relief.
The deal known formally as the Joint Comprehensive Plan of Action (JCPOA) has been hanging by a thread since US President Donald Trump's unilateral decision to withdraw from it in 2018.
Iran has retaliated by gradually reducing its commitments to the JCPOA ever since.
But it agreed on Wednesday to grant the International Atomic Energy Agency the access it has sought to two sites that were suspected of having hosted undeclared activity in the early 2000s.
"Iran is voluntarily providing the IAEA with access to the two locations specified by the IAEA," the two sides said in a joint statement, adding they had agreed on dates for the access and the verification activities there.
The announcement came at the end of IAEA director general Rafael Grossi's first visit to Iran since the Argentine took the post last year.
In their statement, the two sides said the agreement followed "intensive bilateral consultations" and that the IAEA had no further access requests.
"Based on analysis of available information to the IAEA, the IAEA does not have further questions to Iran and further requests for access to locations," they said.
"Both sides recognise the independence, impartiality and professionalism of the IAEA continue to be essential in the fulfilment of its verification activities," they added.
The IAEA's board of governors had passed a resolution in late June put forward by Britain, France and Germany, urging Tehran to provide inspectors access to the two disputed sites.
Grossi met with Iran's President Hassan Rouhani on Wednesday before wrapping up his visit.
"Iran, like before, is ready to closely cooperate with the agency in the framework of safeguards," Rouhani said, according to the government's official website.
He called the agreement "favourable" and said it can help "finally settle issues".
Rouhani also called on Grossi to consider that Iran has "sworn enemies" with nuclear weapons who do not cooperate with the IAEA and are "always seeking to cause issues" for Tehran.
The IAEA monitors Iran's nuclear activities as part of the 2015 nuclear agreement between the Islamic republic and the five permanent members of the UN Security Council -- Britain, China, France, Russia and the United States -- plus Germany.
Since the US pullout, the remaining participants to the deal have been struggling to save it.
Access to the two disputed sites had been blocked for months, prompting a diplomatic row.
According to the spokesman for Iran's nuclear body, one of the two is located in central Iran between Isfahan and Yazd provinces, and the other is close to Tehran.
Iran had argued that the IAEA's access requests are based on allegations from Israel and have no legal basis.
After meeting Grossi, head of Iran's atomic agency, Ali Akbar Salehi, said a "new chapter" had started in relations between the country and the agency.