Iran and Saudi Arabia agree to restore relations after China talks
"As a result of the talks, Iran and Saudi Arabia agreed to resume diplomatic relations and re-open embassies... within two months," Iranian news agency IRNA reported, citing a joint statement by the two sides.
The official Saudi news agency (SPA) also published the statement later on Friday.
Ali Shamkhani, the secretary of Iran's Supreme National Security Council, has been in Beijing since Monday for talks with Saudi diplomats, according to Iranian media.
Previous rounds of diplomatic talks were held in Iraq and Oman in the past two years.
Diplomatic relations between the two countries have been strained since the 2016 execution of the Saudi Shia cleric Nimr al-Nimr, a critic of the Saudi monarchy, and dozens of his supporters. Attacks by Iranian protesters on the Saudi embassy in Tehran following the execution prompted Riyadh to cut diplomatic ties with Iran.
Tensions were also exacerbated by the deadly Saudi-led war on Iran-aligned rebels in Yemen since 2015 and the deaths of hundreds of Iranian Hajj pilgrims in a stampede in the same year.
Iran's semi-official Tasnim news agency reported that Iran and Saudi Arabia have also "emphasised the respect for the sovereignty and non-interference in the internal affairs of each other" and agreed to implement a security cooperation agreement signed on 17 April 2001.
A new page
While more details of the agreement are still emerging, a number of countries have expressed optimism about the thawing of relations between the two regional powers.
The US said on Friday that it cautiously welcomed the new deal. However, White House National Security Council spokesman John Kirby said it remained to be seen "whether Iran is going to meet their obligation".
Iraq, a country often caught between Iran and Saudi Arabia in geopolitical spats, hailed the diplomatic breakthrough.
"A new page has been opened in diplomatic relations between the two countries," the Iraqi foreign ministry said.
Saudi Arabia's neighbours the United Arab Emirates and Oman also welcomed the new deal, with the Emiratis praising the Chinese role in the negotiations.