BP sold its stakes in a group of Gulf of Mexico oil fields to Plains Exploration & Production for $5.6 billion, bringing its total asset sales to $32 billion since the massive oil spill from its Macondo well.

But the company said it would continue to have a big presence in the gulf, where it plans to spend $4 billion a year over the next decade and where it has six exploration rigs drilling for new prospects, as well as four other major production platforms.

The latest sale leaves BP close to its $38 billion goal for divestments to settle claims linked to the spill, part of a program that will leave the London-based oil giant more streamlined but still in possession of its best prospects for growth and most profitable assets. BP chief executive Bob Dudley said in a statement that the sales were “consistent with our strategy of playing to our strengths.”

BP sold interests in three fields connected to the Marlin platform the company installed in 1999 and used as a production hub southeast of New Orleans. It also sold its interests in four other fields and some exploration prospects associated with the fields. Together the fields produced 59,500 barrels a day of oil and natural gas liquids.

Analysts applauded the sale because they said it left BP focused on its most profitable and most promising areas of the gulf, while bolstering its cash for settlements connected to the 2010 oil spill. The spill began when a blowout occurred, setting fire to the Deepwater Horizon oil rig, which sank, killing 11 people.

BP shares closed at $42.04, up 11 cents. The investment firm Raymond James & Associates pointed out in a note to clients that BP is paying a 4.6 percent dividend.

“I don’t think this sale says anything about BP’s devotion to the Gulf,” Stacey Hudson, senior research associate for energy at Raymond James, said in an e-mail. “BP will continue to be a major player there. BP acquired 43 new leases in the Gulf of Mexico in the June 2012 lease sale, and it plans to increase its rig count [there] to 8 rigs by year-end — the highest level it’s ever been.”

BP said it is the leading acreage holder in the gulf, with more than 700 leases. It has moved into deeper and deeper areas over the past decade.

Raymond James said in its note that BP received a “juicy” price for the output, and other analysts agreed.

“BP does not need to sell more assets, but for the right price, more assets can be sold,” said Fadel Gheit, oil analyst with Oppenheimer & Co. “But that goes for all other companies.”

Gheit also noted that “these are the oldest fields with the highest operating costs and lowest returns because they carry very little or no depreciation and depletion expense.”

For Plains Exploration & Production, the huge deal could be hard to digest. The Houston-based independent oil company also agreed to buy $560 million of Shell Oil interests in the gulf, making the $6.1 billion total well above its market value. The company already has production facilities in California, the Rocky Mountains and the Gulf Coast.

Hudson said the fields being sold have smaller production capacities than the four developments BP was hanging onto. He said BP has invested heavily in facilities at those fields. “It makes sense that BP wouldn’t want to sell those after investing money in those projects,” he said.

Those developments include its Thunder Horse, Atlantis, Mad Dog and Na Kika projects.

“The Gulf of Mexico remains a core area for BP, despite the sale,” said Brian Youngberg, oil analyst at Edward Jones. “It is focusing mostly on its larger projects, where it has significant capital employed already and it sees the best returns.”

The full scope of BP’s settlements remain unclear. A multiparty case is still going in a New Orleans federal court, and the Justice Department is still weighing charges. Justice recently submitted a strongly worded filing to the New Orleans court asserting that it would seek to prove BP guilty of gross negligence and willful wrongdoing, charges that would sharply increase the size of fines owed by the company.

BP has been talking about selling its stake in TNK-BP, its joint venture in Russia. While the company has been extremely lucrative, it has also been frought with bickering between BP and its Russian partners.

BP also has entered new ventures, including one with India’s Reliance to explore off the shores of the sub-continent.