There were no reports of any casualties.
"It is believed that a rocket landed on one of the storage tanks for refined crude in the al-Dora refinery," said oil ministry spokesman Assim Jihad.
He said the fire had been isolated and was under control.
"They will extinguish it within the next few hours," Jihad said.
The refinery is one of two that produces Iraq's fuel and receives crude from the country's north and south to supply refined products to Baghdad.
The attack comes after another major oil-producing hub was bombed last week, 100km north of Baghdad.
Seven policemen were killed when a car bomb blew up near the GFX Baiji refinery - the country's biggest - which is connected by a pipeline to oilfields in the nearby city of Kirkuk.
Rockets also hit the Karrada district in central Baghdad and the heavily fortified Green Zone, which houses the Iraqi parliament, the US embassy and many government buildings, police said.
Seven inmates in an interior ministry jail were killed in a mortar attack in the centre of the capital, security officials said.
Another 21 people were also wounded in their cells when up to three mortar rounds hit the facility.