Saudi Arabia and Iran have agreed to resume diplomatic ties and reopen embassies, they said in a joint statement carried by the Saudi state news agency SPA.
The agreement was reached after talks in Beijing between top security officials from the two countries.
Tehran and Riyadh agreed "to resume diplomatic relations between them and re-open their embassies and missions within a period not exceeding two months", according to a statement issued by Iran, Saudi Arabia and China.
"The agreement includes their affirmation of the respect for the sovereignty of states and the non-interference in internal affairs."
They also agreed to activate a security cooperation agreement signed in 2001, as well as another earlier accord on trade, economy and investment.
Both countries thanked China, as well as Iraq and Oman for hosting earlier talks in 2021 and 2022.
The agreement was signed by Iran's top security official, Ali Shamkhani, and Saudi Arabia's national security adviser Musaed bin Mohammed Al-Aiban.
Iran and the US have continued their attacks in the Gulf as each accused the other of violating an increasingly precarious interim deal signed less than two weeks ago to end their four-month-old war.
Australia said on Saturday it would double the maximum penalty it can impose on tech firms found to have failed to uphold a ground-breaking social media ban for children, as evidence mounts that the ban has had little effect on teen use.
A strong earthquake struck Afghanistan's Hindu Kush region on Saturday, the European Mediterranean Seismological Centre said, sending out tremors that could be felt from the capital Kabul across the border into neighbouring Pakistan.
Serbia's populist president Aleksandar Vucic, under pressure after months of anti-government protests, said on Saturday he will resign within weeks and the country will hold early presidential and parliamentary elections.
The death toll from Venezuela's devastating twin earthquakes rose above 1,400 on Saturday as foreign rescue teams poured into the country and authorities pressed on with the search for survivors in the hardest-hit coastal areas.
UAE President His Highness Sheikh Mohamed bin Zayed Al Nahyan held a phone call on Saturday with Delcy Rodríguez, Acting President ofVenezuela, to convey his sincere condolences over the victims of the recent earthquake and wish a speedy recovery to those injured.
The UAE Ministry of Defence has announced the death of soldier Issa Ghuloom Al Baloushi, who passed away during a training mission in the country on Saturday.
The UAE has expressed deep concern over the continued military escalation by the two warring parties in several areas of Sudan, including El Obeid, and the impact on civilians and the worsening humanitarian situation.