An aggressive turnaround helped Petrobras post a record operating profit in the first quarter and move ahead of schedule in reducing a debt burden that is the largest of any major oil firm.

Petrobras reported net income of 4.449 billion reais (US $1.42 billion), well above a consensus estimate of 3.773 billion reais, while improving cash flow and debt metrics. Petrobras lost a net 1.246 billion reais in the first quarter of 2016.

Moves to increase output in some offshore fields, sell non-essential assets and keep expenses in check yielded the firm’s best operating profit ever. Adjusted earnings before interest, taxes, depreciation and amortization (EBITDA) rose 19% to 25.254 billion reais, beating the consensus forecast by 1.38 billion reais.

CEO Pedro Parente said the strong result was driven by recurring factors such as cost controls, putting Petrobras ahead of a timetable to reduce net debt to 2.5 times annual EBITDA by the end of next year, from a ratio of 3.2 at the end of March.

“If we get to 2.5 (times EBITDA) before the end of 2018, that doesn't mean we're going to stop (reducing debt),” Parente told journalists. “We want to keep cutting so we can lower our interest payments.”

A sharp drop in asset impairments also contributed to earnings as Petrobras moved on from a bribery scheme in which the book values of several projects were artificially inflated.

Free cash flow, the money left for holders of bonds and shares after operating and financial expenses, rose 12 percent from the fourth quarter to 13.368 billion reais.

“It was a strong beat across the board that brings about a tipping point for the case,” said Pedro Albuquerque, who runs the Cosmos Capital hedge fund and has a position in Petrobras. “Parente still has room to keep cutting costs, so margins look sustainable.”

Petrobras American depositary receipts were up 3.3% at $10.02 in after-hours trading.

Parente said the sale of natural gas pipeline NTS, which generated 6.7 billion reais in the second quarter, also boosted the odds of paying dividends for the first time since 2014.

To be sure, Parente still faces challenges such as oil prices near decade lows, a corruption scandal that highlighted governance flaws, and losses incurred over many years because of government-mandated fuel subsidies and money-losing investments.

Net revenue slipped 3% from a year earlier to 68.365 billion reais, about 1% below the consensus estimate.