The three-day trip began yesterday and featured talks between Khatami and Azerbaijani President Ilham Aliyev. Speaking after the meeting, Khatami called for closer bilateral ties. He said history and geography have brought the fates of the two countries together.
"The border between the Islamic Republic of Iran and the Republic of Azerbaijan is a border of peace, friendship, and brotherhood," Khatami said.
Khatami said an Azerbaijani consular office will open in the northwestern Iranian city of Tabriz, the center of an Iranian province where millions of ethnic Azeris live. The sides also signed an agreement to improve road and rail links and to fund building an electricity line between Imisli in southern Azerbaijan and Astara at the Iranian border.
"We have always felt Iran's support in the conflict between Azerbaijan and Armenia over Nagorno-Karabakh." - Aliyev
Azerbaijani leader Aliyev expressed satisfaction about the agreements, saying he believes relations between Azerbaijan and Iran are developing successfully. "The implementation of the agreements signed will create thousands of jobs in Azerbaijan," he said. "And agreements on energy and gas swaps will allow us to provide [the Autonomous Republic of] Nakichevan, which is integral part of Azerbaijan, with electricity and gas."
On the political front, Aliyev praised Iran for what he called its "support" for Azerbaijan in the conflict over the Nagorno-Karabakh enclave. "We have always felt Iran's support in the conflict between Azerbaijan and Armenia over Nagorno-Karabakh," he said. "And we are still feeling that today."
Khatami said Iran is ready to contribute to a peaceful solution of the conflict. He added that Iran considers Nagorno-Karabakh part of Azerbaijan and that the use of force in settling international problems is "unacceptable."
However, talks did not produce any breakthrough on the issue of the maritime borders of the Caspian Sea, which touches both countries. The legal status of the Caspian, which contains large reserves of oil and gas, has been in dispute since the Soviet Union collapsed in 1991.
Davood Hermidas Bavand teaches international law in Tehran. He said the visit was important nevertheless. "The significance of the visit is [the] development of good neighborly relationships with Azerbaijan, bearing in mind that we have certain difficulties with that state in connection with the Caspian Sea," he said. "The very objective of this visit is to [come to terms with] existing problems. When the two parties accept this kind of communication, it's an indication that there is a certain intention for improvement of the existing problems."
Experts in Baku suggested the two sides would also discuss the growing U.S. military presence in Azerbaijan, which has contributed to the U.S.-led coalition forces in Iraq. But neither side was ready to comment.
Khatami addressed Azerbaijan's parliament today and met with the parliamentary speaker. He is expected to visit Ganca, Azerbaijan's second-largest city, tomorrow before returning to Iran.
(RFE/RL's Azerbaijani Service contributed to this report.)