This will be the first dispatch of Japanese military personnel to a combat zone since World War II.
Koizumi will begin work on Monday to schedule the dispatch of the Self-Defence Forces (SDF). The first troops are expected to depart in August, followed by a 1,000-strong contingent in October.
The Japanese mission would be to help resettle refugees, rebuild facilities and provide fresh water and supplies. They are banned under the new legislation from providing weapons and ammunition for combat.
Military mission "will leave deep roots of disaster for the future of Japan."
-- Nato Kan, leader of Democratic Party of Japan
The passage of the bill was greeted with anger from opposition lawmakers. Nato Kan, leader of the Democratic Party of Japan, said the military mission "would leave deep roots of disaster for the future of Japan".
Liberal Party secretary general Hirohisa Fujii attacked the government's "irresponsibility and political ignorance".
The opposition, including the leftist Social Democrats and Communists, insists the deployment would violate Japan's anti-war constitution, put Japanese at risk and involve the country in the aftermath of an unjustifiable invasion.
Speaking shortly after the bill was passed, the ruling Liberal Democratic Party secretary general Taku Yamasaki said the presence of Japanese troops in Iraq would meet the country's international responsibilities.
"It is only natural that Japan, as a member of the international community, takes part in the reconstruction of Iraq," he said. “We are convinced that the nation will understand and support the international responsibilities Japan will undertake in the days ahead," he added.
Earlier Koizumi overcame a no-confidence motion tabled by four opposition parties upset with his move to send troops to Iraq. These parties said they would continue to question the legitimacy of the move.
From Thursday afternoon into the small hours of Friday, opposition lawmakers submitted a series of censure motions in the upper house against government ministers to delay the bill. All were easily voted down.
Attempts to derail the bill finally floundered late on Friday as the ruling coalition rejected by 287 votes to 178 a motion of no confidence in Koizumi. The prime minister greeted the result with a bow.
The motion -- which could have triggered the cabinet's resignation or a snap general election if passed -- accused Koizumi of "employing absurd sophistry" to defend the bill.