The US Coast Guard battles a blaze after an explosion at an offshore drilling rig in the Gulf of Mexico in 2010.EPA

NEW ORLEANS — A federal judge in New Orleans has granted final approval to an estimated $20 billion settlement, resolving years of litigation over the 2010 BP oil spill in the Gulf of Mexico.

US District Judge Carl Barbier’s final order on the settlement was released Monday.

The settlement, first announced in July, includes $5.5 billion in civil Clean Water Act penalties and billions more to cover environmental damage and other claims by the five Gulf states and local governments. The money is to be paid out over a 16-year period.

Barbier had set the stage for the settlement with an earlier ruling that BP had been “grossly negligent” in the offshore rig explosion that killed 11 workers and caused a 134 million-gallon spill.