Fresh from securing the lifting of international sanctions imposed over Iran's nuclear programme, Rouhani spent 40 minutes at the Vatican talking privately to Pope Francis, a strong backer of the deal with Tehran.
In a statement afterwards, the Vatican said Francis had urged the Iranian leader to use Iran's important role to promote, together with other countries, "adequate political solutions" to the problems afflicting the region and to help combat terrorism and arms trafficking.
A smiling Rouhani, who presented the pope with a hand-made carpet from the ancient city of Qom, replied with one of Francis's catchphrases.
"I ask you to pray for me," he said. "It was a pleasure to meet you and I wish you well in your work."
More From This Section
In return for his gift, Rouhani was given a medal depicting St Martin cutting his cloak in half to give to a poorly clothed beggar.
It was the first official visit to the Vatican by an Iranian president since Mohammad Khatami was hosted by John Paul II in 1999. Khatami also attended the Polish pope's funeral in 2005.
Rouhani is on a five-day trip to Italy and France looking to drum up trade and investment to modernise Iran's economy, partly by pitching the country as a beacon of stability in a conflict-wracked region.
Iran is seeking international investment to help complete a port which will provide a gateway for Indian companies seeking to do business in Afghanistan and Central Asia, as well as in Iran.