Representatives from Iran and Saudi Arabia have agreed to re-establish relations after a seven-year diplomatic rupture.
Iranian and Saudi state media say the agreement was reached after talks in Beijing between top security officials from the countries.
Iran's IRNA news agency said the two sides also agreed to re-open embassies within two months.
The Associated Press reports the deal represents a major diplomatic victory for Beijing as Gulf states perceive the United States as slowly withdrawing from the wider Middle East.