Here's why the deal is important for easing tensions, and what you need to know about the long-disputed Caspian Sea.
At the conclusion of the summit in the Kazakh city of Aktau on Sunday, the presidents of Iran, Russia, Turkmenistan, Kazakhstan and the Republic of Azerbaijan signed the convention on the Caspian legal regime.
The question whether the Caspian Sea is an ocean or a lake is set to determine the future of the vast body of landlocked water.
The leaders agreed to establish 15-mile-wide territorial waters off the Caspian coast for each nation.
The pact signed at a summit in Kazakhstan today takes both approaches in a compromise treating the surface as global water and dividing the seabed into territorial zones.
The convention emphasizes that the Caspian Sea belongs to all littoral states, prohibiting establishment and handing over of any kind of military bases to foreign countries.
The agreement says no country without Caspian shoreline can deploy military vessels in the sea.
The agreement apparently permits something that Russian Federation had been opposing - allowing Turkmenistan to build a "Trans-Caspian Pipeline" (TCP) to permit delivery of its gas to Azerbaijan, where it would be pumped into pipelines leading west to Turkey and Europe.
Global oil companies that rushed to the area in the 1990s have now pulled out.
Rouhani also pointed out that the two countries have many grounds for joint ventures and mutual assistance services, and added that Iran and Kazakhstan's capacities in different sectors, especially in transit, could complement each other so that Kazakhstan would be able to reach the southern waters through Iran and Iran Can be connected to China via Kazakhstan.
Nevertheless, analysts caution that Turkmenistan's long-held plan to send gas through a trans-Caspian pipeline to markets in Europe via Azerbaijan is not necessarily closer to becoming reality. The Afghan government has said it could help resolve the war through economic development. From there, the cargo is taken by rail to Afghanistan, where the United States has been militarily engaged since 2001.
Iran and four ex-Soviet nations, including Russian Federation, agreed in principle on Sunday how to divide up the potentially huge oil and gas resources of the Caspian Sea, paving way for more energy exploration and pipeline projects.
The problem is that the Caspian Sea is a unique body of water in the world, and so there are no examples to provide guidance.