Pemex on May 3 reported a first quarter net profit of 87.9 billion pesos (US$4.7 billion), the firm’s first quarterly profit since 2012, on higher sales as crude prices rose despite lower output.

During the year earlier period, Pemex posted a loss of 62 billion pesos ($3.3 billion).

Revenue at the company, officially known as Petroleos Mexicanos, was up 55% to 349 billion pesos ($18.6 billion), according to a filing with the Mexican stock exchange.

First-quarter crude production stood at 2.018 million barrels per day (MMbbl/d), down 9.5% from average output of 2.23 MMbbl/d during the January-March period last year. Pemex hit peak crude production in 2004 with 3.4 MMbbl/d, but since then the limping Mexican oil giant has seen output drop by more than 1.3 MMbbl/d.

Long a major source of tax revenue for the nation'’s government, Pemex now contributes less than a fifth of federal revenue, down from more than a third a few years ago.

The Mexican government continues to implement a sweeping energy reform finalized in 2014. The reform ended the decades-long production monopoly enjoyed by Pemex, and led to the first-ever competitive oil auctions and joint venture partnerships.