Iranian Foreign Minister Mohammad Javad Zarif, who arrived in the Iraqi capital earlier in the day, thanked Baghdad for having "refused the unjust and illegal sanctions imposed on the Iranian people", in reference to the US sanctions.
Rouhani, a relative moderate, used the start of his three-day trip to criticize the United States, which has sought to isolate Iran.
"Iran-Iraq relations are not comparable with (Iraq´s relations) with an aggressor country like America", Rouhani said.
Iraq, which receives financial and military support from Washington, has attempted to balance its relations with the United States and Iran, which carries significant influence with members of Iraq's Shi'ite population.
"We want to be united countries, not against others, but attracting others to our unity", Rouhani said.
He will visit a Shia shrine in the Iraqi capital and then meet President Barham Salih and Prime Minister Abdel Abdul Mehdi, as well as visit other politicians and Shia leaders.
Iraq was given limited waivers to continue buying electricity and natural gas from Iran, with Washington calling on Baghdad to partner with USA companies to become energy independent.
The deals, among them a plan to build a railway linking the neighbors, emerged soon after the start of Rouhani's visit, meant to underline that Tehran still plays a dominant role in Iraq despite US efforts to isolate the Islamic Republic.
Silva furious as Newcastle hit back to sink Everton
The link between Ayoze Perez and Salomon Rondon , if Messi was doing that everybody would be talking about the goal. He said: "When they scored the third goal it was a big mistake by the assistant, nothing more to say".
Trump Budget Sees $1 Trillion Deficits for Next Four Years
That report projected muted economic gains in coming years, partly because of the fading impact of tax cuts and higher spending. Fresh off the longest government shutdown in history, his 2020 plan shows he is eager to confront Congress again over the wall.
Britain must leave European Union by May 23 or hold own European Union vote
As a result, all focus will then be on a third vote, expected by Thursday, to decide if the Brexit deadline of March 29 should be delayed.
"Iraq is another channel for Iran to bypass America's unjust sanctions imposed on Iran".
Iran also sees Iraq as a possible route to bypass US sanctions that Trump re-imposed previous year after pulling the USA out of the 2015 nuclear deal.
The two countries fought a bloody war from 1980 to 1988 and Tehran's influence in Baghdad grew after the 2003 US-led invasion of Iraq toppled the government of Saddam Hussein.
Rouhani, who had visited Iraq privately before becoming president, had planned an official visit in 2016 but it was canceled over unspecified "executive" problems.
Last year, Iran's exports to Iraq amounted to almost $9 billion US.
He pointed out that Iran had stood by Iraq in "difficult" times - a reference to its training and arming of thousands of Iraqi Shia paramilitary fighters who have helped drive Islamic State (IS) militants out of the large parts of Iraq they seized in 2014.
Last year, Iran's exports to Iraq amounted to almost $9 billion.
The premier expressed his heartfelt condolences on the recent terrorist attack in Iran in which 27 Revolutionary Guards were killed, the PM Office statement said. Tehran hopes to increase the roughly $13 billion volume in trade between the two neighbouring countries to $20 billion.