Brigadier Qassim Mussawi, the military spokesman for the prime minister's office, said: "We received intelligence tips about car bombs and suicide bombers entering Baghdad and trying to make attacks today and we are targeting them now.
"What happened today is a precautionary measure to prevent harm to civilians and to prevent terrorists from targeting them. Security forces are restoring their control over Baghdad and all the provinces."
Civilian flights to and from Baghdad airport have been stopped during the curfew which will last until 6am on Sunday.
US commanders have said that the first week of the Islamic fasting month of Ramadan has seen a record number of suicide bombings, and that the past two weeks have seen a significant surge in violence.
A US military spokesman would not confirm whether or not they had recommended the curfew, but said that "intermittent curfews have been an effective means of reducing violence in the past".
A security crackdown begun by US and Iraqi security forces seven weeks ago is ongoing in Baghdad.
Outside the capital sporadic violence continued.
130 people were detained during
raids by Iraqi forces in Baquba
In the northern, mainly Kurdish city of Kirkuk, a car bomb exploded in front of a police colonel's house. At least 10 people were wounded, police sources said.
In Iskandariya, 40km south of Baghdad, a roadside bomb killed one person and wounded four.
Meanwhile, in the town of Tal Afar, in the far northwest of the country, policemen opened fire on a suspicious vehicle heading towards them which then exploded killing two people and wounding 30.
And in Diyala province, north of Baghdad, a major Iraqi security operation has been carried out by Iraqi forces.
Brigadier-General Shakr al-Kaabi said: "For the second day running our forces have launched raids and made detentions in western neighbourhoods of Baquba.
"We have arrested 130 people, of whom 85 were wanted.
"Weapons and ammunition were seized in these neighbourhoods, including sticks of dynamite and artillery shells."
Kaabi said the army's intervention had stopped what he called an attempt to drive Shia families out of the area and declare a Sunni "emirate".