Tehran has accused Saudi of hindering its efforts to bring home the bodies of at least 239 Iranians who died in last week's tragedy near Makkah.
Another 241 people, including senior Iranian diplomat and former ambassador to Lebanon, are among the Iranians still listed as missing six days after the deadly crush.
Read: Iran leader threatens 'fierce' reaction if Saudi does not return Hajj dead
"The two parties have agreed on the repatriation of the bodies of identified dead Iranians as soon as possible," Saudi's SPA state news agency reported early Thursday following talks between the rivals in Jeddah.
The two sides will also "maintain contacts to identify the rest and look after the wounded," SPA added under the agreement struck between Saudi health minister Khaled al-Falih and his Iranian counterpart Hassan Hashemi.
It said the Saudi minister "stressed the kingdom's government's wish to cooperate with the Islamic Republic of Iran".
Read: Iran protests Saudi delay in repatriating Hajj dead
Tehran claimed last week that Saudi authorities have failed to issue visas for Iranian officials who sought to travel to the kingdom to facilitate the repatriation of the dead and the injured.
The two regional rivals were already at odds over Iran's support for Houthi rebels in Yemen, which lies on Saudi Arabia's southern flank. That prompted Riyadh to form a coalition of Arab nations to combat the Houthis.
"Saudi officials are failing to do their duties," Iran's supreme leader Ayatollah Ali Khamenei said in a speech to graduating navy officers, following delays in the return of the Hajj dead, accusing some of the officials of "slyness".
Read: As insults fly, Iran-Saudi Hajj row aggravates regional rifts
"They should know that the slightest disrespect towards tens of thousands of Iranian pilgrims in Makkah and Medina and not fulfilling their obligation to transfer holy bodies will have Iran's tough and fierce reaction."
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ