A suicide car bomb went off at the entrance of the facility in Taji at around 0600 local time (0300 GMT), allowing another vehicle carrying at least six attackers with explosive vests to enter and clash with security forces, police sources said. Twenty-one people were also wounded.
The militant group said in an online statement that four fighters with machine guns had killed the guards at the plant which it said the Iraqi army was using as a headquarters.
When reinforcements arrived, they set off a parked car bomb before clashing with the security forces and detonating their suicide vests.
A spokesman for Baghdad Operations Command said three of the facility’s gas storages were set alight before security forces were able to bring the situation under control.
Iraq’s Oil Ministry said the attack had not disrupted the plant’s production of gas for cooking and electricity production.
But the Electricity Ministry said two nearby power stations had halted operations due to a cut in gas supplies from the Taji plant. It was not clear how long it would take to restore flow to the power stations, which provided 153 megawatts to the already overstretched national grid before the attack.
Video broadcast by Al Hadath TV showed a fireball surging from the plant.
An employee who lives nearby said after hearing a powerful blast he saw flames and black smoke coming from inside the facility. Dozens of police and army vehicles rushed to the site where shooting lasted for about an hour, he said.
Islamic State, which controls swathes of the country’s north and west, has carried out a string of bombings this week that killed around 100 people.
Prime Minister Haider al-Abadi said on Saturday the militants were taking advantage of a political crisis in the country, sparked by his attempt to overhaul its quota-based governing system, to conduct bombings in areas under nominal government control.
A U.S.-led coalition backing the Iraqi government in its fight against Islamic State has been training army forces for months at a military base located in Taji.
Separate explosions in Baghdad’s southern outskirts on Sunday left three people dead and 12 wounded, police sources said.