The deal was signed after several days of negotiations between the head of Iran's Supreme National Security Council and his Saudi counterpart in Beijing.
The foreign ministers of the two countries are now going to hold a bilateral meeting to discuss the implementation of the agreement.
In a joint statement, Iran and Saudi Arabia announced that they had agreed to resume cooperation on security, trade and investment.
"The ministers of foreign affairs of both countries shall meet to implement this, arrange for the return of their ambassadors, and discuss means of enhancing bilateral relations. They also agreed to implement the Security Cooperation Agreement between them, which was signed on 22/1/1422 (H), corresponding to 17/4/2001, and the General Agreement for Cooperation in the Fields of Economy, Trade, Investment, Technology, Science, Culture, Sports, and Youth, which was signed on 2/2/1419 (H), corresponding to 27/5/1998," the tripartite agreement, published by the Saudi Press Agency, says.
The joint statement was signed after several days of negotiations between the head of the Supreme National Security Council of Iran and his Saudi counterpart in Beijing.
Ali Shamkhani, the secretary of Iran's Supreme National Security Council (SNSC), has thanked China for facilitating the talks.
"I highly appreciate the constructive role of the People's Republic of China in supporting the development of relations between countries, which is necessary to solve problems and strengthen peace and stability, as well as the development of international cooperation," he said.
He also pointed to the role of Oman and Iraq in leading the initial five rounds of talks between Tehran and Riyadh to reach a final agreement.
The two countries have had no diplomatic relations since the January 2016 execution of Saudi Shiite cleric Sheikh Nimr al-Nimr, a critic of the Saudi monarchy who was arrested repeatedly for suggesting that Saudi Arabia’s oil-rich Eastern Province should secede from the kingdom if Shia rights were not respected. Al-Nimr’s killing prompted mobs of angry protesters to attack the Saudi Embassy in Tehran, with Riyadh cutting ties and Tehran reciprocating.
However, in 2022, Saudi Arabia and Iran held several rounds of talks to restore broken relations and find possible ways to resolve differences.