The settlement includes a $1.3bn criminal fine, the largest such levy in US history, the company said.
Analysts said the deal let BP put its focus back on oil production, though at least one member of Congress questioned whether it would hurt states' chances for civil penalties.
The April 2010 explosion on the Deepwater Horizon rig in the Gulf of Mexico killed 11 workers. The mile-deep Macondo oil well then spewed 4.9 million barrels of oil into the Gulf over 87 days, fouling shorelines from Texas to Florida and eclipsing in severity the 1989 Exxon Valdez spill in Alaska.
The oil company said it would plead guilty to 11 felony counts related to the workers' deaths, a felony related to obstruction of Congress and two misdemeanours.
BP, which replaced its chief executive after the spill as its market value plummeted, still faces economic and environmental damage claims sought by four Gulf Coast states and other private plaintiffs.
Wall Street analysts were encouraged that the plea deal could resolve a significant share of the liability BP faces. But it is not a "global" deal to resolve all outstanding liability.
"It certainly is an encouraging step," said Pavel Molchanov, oil company analyst with Raymond James. "By eliminating the overhang of the criminal litigation, it is another step in clearing up BP's legal framework as it relates to Macondo."
Other analysts said the settlement had been a communications challenge for the company, and they hoped to receive more detail next month.
"Of course you never like to see value moving out of the company, but it's good news if this will allow them to be an oil company again," said Jason Gammel, energy analyst at Macquarie in London.
The disaster has dragged BP from second to a distant fourth in the ranking of top Western oil companies by value. It said the payments would be spread out over six years in total.
BP has sold $35bn worth of assets to fund the costs of the spill. Matching that, it has paid $23bn already in clean-up costs and claims, and has a further $12bn earmarked for payment in its spill trust fund.
Still unresolved is potential liability faced by Swiss-based Transocean Ltd, owner of the Deepwater Horizon vessel, and Halliburton Co, which provided cementing work on the well that US investigators say was flawed. (Reuters)