British energy giant BP said that its bottom line was hit by an accounting charge in third quarter, but underlying earnings rose strongly on the back of soaring oil prices.
BP said in a statement that its net loss widened to $2.5 billion (2.9 billion euros, $3.4 billion) in the period from July through September from $450 million in the same period a year earlier.
The group attributed the deeper loss to "significant adverse accounting effects" of $6.1 billion, "primarily due to the exceptional increase in forward gas prices towards the end of the quarter".
By contrast, underlying profit surged to $3.3 billion in the third quarter from $86 million a year earlier, BP said.
Gas prices, along with oil futures, have risen sharply in recent months, boosting income for energy majors, but weighing on business costs and households' spending power.
"Rising commodity prices certainly helped," said chief executive Bernard Looney.
"But I am most pleased that quarter by quarter, we're doing what we said we would -- delivering significant cash to strengthen our finances, grow distributions to shareholders and invest in our strategic transformation."
BP also announced plans to buy back shares totalling $1.25 billion.
Looney, who was appointed chief executive at the start of the global coronavirus pandemic early last year, wants BP to achieve "net zero" carbon emissions by 2050 as energy majors worldwide increasingly move to cleaner, sustainable energy sources.
Energy prices have soared over the past year as pandemic-hit economies reopen, but rising inflation could put the brakes on the global economic recovery.
Like its rivals, BP slumped deep into the red in 2020 as the Covid-19 pandemic slashed energy demand and prices.
That resulted in top oil companies shedding thousands of jobs.
But oil prices -- which even briefly turned negative last year -- have since rebounded sharply, with the benchmark Brent North Sea oil contract trading around $85 per barrel.
"The cash tills are ringing at BP given the oil price headwind, but an accounting adjustment has driven a loss for the quarter," said Richard Hunter, head of markets at Interactive Investor.
"BP's prodigious cash generating ability has not only enabled the announcement of a further planned share buyback... but also a remarkable 20 percent reduction in net debt over the last 12 months".
BP's debt still stands at a hefty $32 billion.