BP returned to profit in the second quarter, the British energy giant announced Tuesday, having posted a hefty loss one year earlier as the pandemic crushed oil prices.

Net profit for April-June hit $3.1 billion (2.6 billion euros). That compared with a loss after tax of $16.8 billion in the second quarter of 2020.

With demand for crude crashing as the coronavirus pandemic took hold early last year, oil prices plunged into negative territory.

They have since recovered with a bang, currently trading above $70 per barrel.

Oil demand was recovering on "a bright macroeconomic outlook, increasing vaccination roll-out and gradual lifting of Covid-19 restrictions around the world", BP said in its results statement Tuesday.

"The expectation is that demand reaches pre-Covid levels sometime in the second half of 2022."

In the wake of the pandemic, BP decided to axe about 10,000 jobs, or 15 percent of its global workforce, while it embarked upon major asset disposals.

BP on Tuesday said it had completed deals on divestments totalling $14.9 billion out of a target of $25 billion.

It comes as Bernard Looney, who became BP chief executive when the coronavirus began taking hold worldwide, wants the company to achieve "net zero" carbon emissions by 2050.

BP returned to profit as oil prices recovered
BP returned to profit as oil prices recovered AFP / Glyn KIRK

It hopes to achieve this with the help of an expected drop in oil and gas production that is pushing energy majors worldwide to up their game regarding cleaner, sustainable energy sources such as electricity and wind power.

"We are a year into executing BP's strategy to become an integrated energy company and are making good progress -- delivering another quarter of strong performance while investing for the future in a disciplined way," Looney said in Tuesday's results statement.

BP added that it was hiking its shareholder dividend and launching a buyback of shares totalling $1.4 billion.

The turnaround in results mirrors the picture at BP rivals, with Chevron, ExxonMobil and Shell all posting bumper second-quarter earnings.

"There is little doubt that the rise in the oil price has helped BP this quarter, along with the rest of its peers," noted Michael Hewson, chief market analyst at CMC Markets.

"However if the company wants to meet CEO Bernard Looney's plans for a 40-percent reduction in oil and gas production by 2030, then it will need to invest a lot more in renewables."

BP's share price jumped 2.6 percent following the results, topping London's benchmark FTSE 100 index.