The deal will help the French energy giant bolster its position among the world's largest oil companies, potentially boosting its earnings and cash flow and shoring up its ability to pay dividends.

For Maersk, among the world's largest shipping companies, the deal streamlines its business as it grapples with historic downturns in both the shipping and oil industries.

It is the first sale for Maersk after it announced plans to break up the company last September. It is also looking to sell or list by the end of next year other units, such as Maersk Drilling, which operates oil and gas rigs mainly in the North Sea, and Maersk Tankers, which moves oil and oil products on a fleet of 158 vessels, and Maersk Supply, a fleet of 44 support ships for offshore operations.

Maersk is trying to reshape itself into a global supply-chain player like United Parcel Service Inc. and FedEx Corp. The plan involves moving more ships through its port operations, APM Terminals, and more cargo inland through Damco, its supply-management division handling airfreight, trucks and warehouses.

Advertisement

"We are investing in our core business" of shipping, Maersk Group Chief Executive Soren Skou said. The sale to Total "will strengthen the financial flexibility of AP Moller-Maersk and free up resources to focus our future growth on container shipping, ports and logistics," he said.

The acquisition, announced by both companies on Monday, is the latest sign of consolidation in the oil-and-gas industry, which finally appears to be stabilizing after a prolonged downturn in petroleum prices.

Total and other big oil companies say they have reduced their costs enough to generate cash at crude prices at current levels, about $50 a barrel, giving them flexibility to grow through acquisitions.

In the U.S., where small shale-oil producers have proved remarkably resilient amid low energy prices, the sector has experienced a flurry of deals. So far this year, deals in North America have totaled $73.2 billion, more than in all of 2016, according to data from Edinburgh-based consultancy Wood Mackenzie.

Activity has also picked up internationally, particularly in Europe. Though the number of European deals so far this year stands at roughly half the level of those completed in 2016, their value has reached $16.8 billion, compared with $5.3 billion in all of 2016, according to Wood Mackenzie.

Many of the acquirers have been private-equity firms and smaller players, eager to get a foothold in major oil areas such as the North Sea.

Earlier this year, Shell sold its British North Sea assets to Chrysaor Holdings Ltd. in a deal valued at as much as $3.8 billion. Chrysaor is backed by Harbour Energy Ltd., an investment vehicle managed by Washington-based EIG Global Energy Partners.

Total's acquisition of Maersk Oil is one of the biggest deals in the sector since Shell's roughly $50 billion acquisition of BG Group last year.

Total will pay for the deal with $4.95 billion in shares, while also taking on $2.5 billion in Maersk oil debt. The French company will also assume nearly $3 billion in expected costs for decommissioning oil rigs in the North Sea.

"We imagine [Total] investors won't be overly enthused with the idea of buying more oil barrels when they are overly concerned with falling oil demand," Bernstein said Monday in a note that praised the deal for adding potentially profitable barrels.

The deal is a vote of confidence in the North Sea, where around 80% of Maersk's reserves are located. The region has been a major oil-and-gas hub for decades but has also been plagued by high costs, aging infrastructure and declining production.

Total will be northwest Europe's second-largest offshore operator once the deal closes, expected in next year's first quarter. The deal has been approved by both companies' boards but remains subject to shareholder votes and regulatory approvals.

--Dominic Chopping contributed to this article.

Write to Sarah Kent at sarah.kent@wsj.com and Costas Paris at costas.paris@wsj.com