The US government and five states have reached a $18.7bn (£12bn) settlement with BP over the 2010 Deepwater Horizon oil disaster.
BP Exploration and Production has been granted up to 18 years to pay the money.
The states involved in Thursday's settlement were Texas, Florida, Alabama, Mississippi and Louisiana.
The deal includes $8.1bn in payments to state and local governments, plus $5.5bn in Clean Water Act fines.
US Attorney General Loretta Lynch said the settlement "would bring lasting benefits to the Gulf region for generations to come".
BP said the agreement would bring its full obligations over the spillage to about $53.8bn.
The explosion and fire left 11 workers dead and an estimated 473 million litres of oil in the Gulf of Mexico.
The disaster struck on 20 April, 2010, when a deep sea well suffered a blowout that resulted in flames engulfing the Deepwater Horizon platform.
Investigations later identified poor safety procedures.
The accident also destroyed the market value of BP - ground it is yet to recover.
News of the deal pushed BP shares up 5% in late afternoon trading.
However, its market capitalisation remains £40bn short of its pre-Gulf crisis level.
That figure represents half its current value.
The fallout from the spill claimed the job of then-chief executive Tony Hayward, who contributed to the PR disaster with gaffes as the company scrambled to cap the Macondo well.
Bob Dudley, who succeeded him, said: "This is a realistic outcome which provides clarity and certainty for all parties.
"For BP, this agreement will resolve the largest liabilities remaining from the tragic accident and enable BP to focus on safely delivering the energy the world needs."