The bomb detonated at 10:20 (0220 Eastern) in the Bab al-Mudham area of central Baghdad. The car was parked on a road leading to the Housing and Municipality Ministry located in that the area, police added. Police and hospital officials gave the death and injury toll.
The dead included one police officer, while another four were wounded. The Bab al-Mudham district is a commercial area on the eastern side of the Tigris River.
Ahmadinejad, the first Iranian president to visit Iraq, said the foreign presence in the Arab country was an "insult to the regional nations and a humiliation."
"We believe that the major powers who have come to the region from thousands of kilometers away should respect the will of nations and leave this region. That's the best service they can offer these nations," Ahmadinejad said after meeting with Iraq's president on the two-day trip.
The hardline Iranian leader arrived Sunday for an unprecedented visit to Iraq. He took the chance to build ties with officials in a once-hated neighbor and to accuse the United States of spreading terrorism.
CBS News correspondent Allen Pizzey reports Ahmadinejad's visit was a firm symbolic gesture to Washington, "that Iran can't be ignored, or even short-changed as a player here".
Ahmadinejad said talks Sunday with Iraqi President Jalal Talabani, a Sunni Kurd who told the Iranian to call him "Uncle Jalal," were "brotherly." Then he cut through the U.S.-controlled Green Zone to visit Prime Minister Nouri al-Maliki, a fellow Shiite, in his Cabinet offices.
The sprawling Green Zone contains the core of the U.S. diplomatic mission to Iraq - including a massive new embassy - and is heavily protected against occasional rocket attacks, which the Americans have blamed on Iranian-backed Shiite extremists.
Ahmadinejad denied the charges at least twice in news conferences throughout the day.
"Six years ago, there were no terrorists in our region. As soon as the others landed in this country and the region, we witnessed their arrival and presence," he said Sunday night after meeting Abdul-Aziz al-Hakim, the leader of the largest Shiite political bloc.
Earlier, Ahmadinejad said that "such accusations increase the problems of the Americans in the region. The Iraqi people do not like the Americans."
The Iranian delegation seemed to enjoy the contrast between Ahmadinejad's visit and trips to Iraq by President Bush.
Ahmadinejad announced the dates of his visit in advance, landed at Baghdad International Airport in daylight and drove through the capital, albeit in a heavily guarded convoy, on a relatively quiet day. Iraqi forces provided security.
Mr. Bush's visits are typically a surprise and involve trips to U.S. military bases, like his journey to an air base in Anbar province last September.
In other developments:
The day before the Iranian president arrived, the chairman of the U.S. Joint Chiefs of Staff, Adm. Mike Mullen, came to Baghdad unannounced to visit with commanders and Iraqi officials.
On Saturday, Mr. Bush advised al-Maliki to tell the Iranian leader to "quit sending in sophisticated equipment that's killing our citizens."
Rear Adm. Gregory Smith, a military spokesman, reiterated Sunday that the U.S. hopes the Iranian-Iraqi meetings produce "real and tangible results," which in the American view would include Iran ending its alleged training and funding of extremists.
The tone among Ahmadinejad and his Iraqi hosts, meanwhile, was more than cordial.
"We had very good talks that were friendly and brotherly," Ahmadinejad said after meeting with Talabani, who greeted him with an honor guard and a band that played both countries' national anthems. "We have mutual understandings and views in all fields, and both sides plan to improve relations as much as possible."
After a meeting involving Ahmadinejad, al-Maliki and their advisers, the Iraqi prime minister said the visit was "an expression of the strong desire of enhancing relations and developing mutual interests after the past tension during the dictatorship era."
While both countries have a Shiite majority, their relationship has been checkered.
They were hostile to each other throughout the long reign of Saddam Hussein, a member of Iraq's Sunni minority, and fought a catastrophic eight-year war after Saddam invaded Iran in 1980. About 1 million people died in the conflict.
Ahmadinejad, seen at left addressing journalists at the joint news conference with al-Maliki, said he was "very pleased with his visit to an Iraq not ruled by a dictator."
Still, the Iraqis are precariously balanced between U.S. and Iran, with government officials saying in recent weeks that they don't want the country torn apart in a power struggle between the two sides.
Hundreds of protesters gathered in Fallujah, the scene of two battles between U.S. troops and Sunni insurgents, and demonstrated for an hour against Ahmadinejad's visit. "The chieftains of Fallujah condemn the visit of Ahmadinejad to Baghdad," one of their banners read. Another 50 people demonstrated against the visit in northern Kirkuk, and tribal chieftains in the country's Shiite-dominated southern region signed a petition against the visit.
Adnan al-Dulaimi, one of Iraq's most influential Sunni politicians, called for restraint. He said the visit indicated the strong Iranian influence in Iraq but hoped it would decrease tension between the two countries.
"We call upon the United States and Iran not to make Iraq a field for their struggle," he said.