(Bloomberg) -- Brazil’s state-controlled oil company saw its earnings surge in the second quarter, thanks to a rally in crude prices and a hydropower crunch in Brazil that boosted electricity demand.

Since late last year, Petrobras has sold more fuel oil domestically and increased output at its own thermal power plants, part of a wider policy in Brazil to conserve water levels at hydroelectric dams and avert power outages. Though the energy and power division at Petroleo Brasileiro SA, as the company is formally known, represents a fraction of overall revenue, it was a standout. Electricity generation more than tripled in the second quarter from a year ago.

Petrobras also got a boost from this year’s oil-price rebound, which has delivered robust earnings to energy giants, many of which are printing as much profit as before the pandemic. As a result, many of Petrobras’s U.S. and European peers have been using the cash to boost dividends and slash debt. It’s a stunning turnaround for an industry that was on the ropes a year ago amid a pandemic-induced price crash.

Also Read: Big Oil Shows Confidence The Era of Large Profits Is Back

Petrobras reported 42.86 billion reais ($8.3 billion) of net income, up from 1.17 billion in the first quarter. Thanks to the strong results, the company said it will bring forward shareholder payouts of 31.6 billion reais for this year.

Petrobras continues to increase oil output from the so-called pre-salt region that holds its largest and most profitable discoveries. A 180,000-barrel-a-day production vessel is expected to start this month and gradually ramp up at the Sepia field. This and other new units allow Petrobras to continue boosting output at ultra-deep fields, and compensate for production it has lost due to asset sales and natural declines at legacy fields.

Petrobras continued to slash what was once the biggest debt load of any publicly traded oil company, which stood at $63.7 billion at the end of the second quarter. The company has vowed to increase dividend payments when it brings total debt below $60 billion, a target it expects to achieve next year. The ongoing divestment program has helped Petrobras trim debt. It has raised $2.8 billion from selling assets for the year through Aug. 3.

It was the first quarter under the management of Chief Executive Officer Joaquim Silva e Luna, a former general who took over in April following a row between President Jair Bolsonaro and the previous CEO about rising diesel prices. Luna has pledged to avoid fuel subsidies and continue with Petrobras’s current business plan, which calls for divesting assets including refineries to focus on its most profitable projects in the pre-salt.

Read: Traders Who Dumped Petrobras Misread the General-Turned-CEO

Investors are waiting to see how strongly Luna will defend Petrobras from political intervention. The company recently denied a claim from Bolsonaro that it had earmarked 3 billion reais to subsidize cooking gas for families in need.

©2021 Bloomberg L.P.