MEXICO CITY — The chief executive of Mexico’s state-owned oil company Pemex, Emilio Lozoya Austin, stepped down on Monday, a casualty of the energy giant’s struggle with collapsing oil prices and declining production.

In his place, Mexico’s president, Enrique Peña Nieto, appointed José Antonio González Anaya, a Harvard-educated economist with a long career in Mexico’s finance ministry. Mr. González Anaya has spent the last three years as the head of Mexico’s sprawling social security institute, the country’s main public health system.

Concern over Pemex’s finances has risen over the past week. Last week, the president of the central bank, Agustín Carstens, issued a sharp warning that planned spending cuts at Pemex could not be postponed.

Mr. Lozoya, who was appointed to lead Pemex at the start of President Peña Nieto’s term three years ago, was seen as a capable turnaround specialist from the private sector who could wring efficiencies from the company.

His chief task was preparing Pemex for stiffer competition as the government began to open Mexico’s closed oil sector to the private sector in an effort to reverse the decline in output. Pemex crude production has fallen by more than a million barrels a day since its peak in 2004.

But special interests at the company, like its unions and its private contractors, hampered those efforts.

“I think nobody anticipated a crisis of this dimension at Pemex,” said Luis Miguel Labardini, a partner at Marco y Asociados, an energy consultancy here. “There were so many changes that were needed, but one way another he was not able to do the job.”

Mr. González Anaya is not new to the oil company. As a former finance under secretary, he served on the energy giant’s board.

The Mexican government taxes Pemex heavily to finance national spending, taking enough money that the company has long operated at a loss. That also means that Pemex was unable to invest in new oil fields when it had the benefit of high prices.

Analysts say that Pemex’s most profitable opportunities lie in the deep of the Gulf of Mexico, but finding and developing new deepwater fields is so expensive that oil companies usually establish joint ventures.