Tehran-Baku ties “have made considerable progress in the past three years,” Rouhani said at a joint news conference with his Azerbaijani counterpart Ilham Aliyev who arrived in Tehran Sunday for a one-day visit.
President Rouhani also said the two Muslim countries view terrorism as a major threat, and share common views on the need to fight terrorists in Iraq, Syria and elsewhere.
"We see terrorism, which is unfortunately rooted in the Wahhabi and Salafi ideology, as a big threat to the region and believe the roots of this ideology need to be dried up," the president said.
"On the issue of Syria and Iraq, we share common views and hope efforts by Iran, Turkey and Russia will bear fruit," Rouhani said, adding the ultimate solution for Syria has to be political.
"Iran believes the territorial integrity of countries must be respected and regional problems resolved through political means and dialog."
Aliyev said political relations between Iran and Azerbaijan were "excellent" while economic cooperation between the two countries had made considerable progress.
His visit to Tehran is the third in the past three years during which he met with President Rouhani eight times, Aliyev said, adding cordial bilateral ties are rooted in cultural, historical and religious commonalities.
"These visits show relations between the two countries are progressing proudly."
Bilateral trade grew 70% in 2016 following the implementation of bilateral agreements, Aliyev said as he cited 18 MoUs signed in recent years.
"Today, two more documents were signed which is a good basis for strengthening relations," he added.
Aliyev also hailed Iranian firms for investing in Azerbaijan, citing Iran's stakes in Shah Deniz which is Azerbaijan's largest gas field in the Caspian Sea as well as oil drilling operations.
Rouhani said Iran is ready for swapping oil and oil products with Azerbaijan. He also touched on transit cooperation, saying their recent completion of a rail road linking the Iranian city of Rasht to Astara in Azerbaijan had marked an important step in this regard.
In their talks, the two sides also discussed cooperation on environmental issues as well as the Caspian Sea legal regime. The sea is shared by Iran, Azerbaijan, Russia, Turkmenistan and Kazakhstan.
"Legal issues in the Caspian Sea require the consensus of the five countries. In this context, cooperation, consultation and negotiation between Iran and Azerbaijan is very important," Rouhani said.
Aliyev said Azerbaijan attaches great importance to the South-North Corridor, which stretches from the Indian Ocean to Russia, China, Central Asia and East Europe.
He also thanked Tehran for its efforts to resolve the Karabakh dispute between Azerbaijan and Armenia.
Iran has repeatedly announced readiness to mediate between the two sides. Rouhani said the Islamic Republic believes all regional problems, including the Karabakh conflict, should be resolved thorough dialog.