CIUDAD DEL CARMEN, Mexico — The town that oil built is emptying out.
“For Sale” signs are plastered on concrete-block houses and sun-bleached bungalows alike. The idled oil workers who used to cluster in the main square, hoping to pick up odd jobs, have moved on.
Here in Ciudad del Carmen, on the gulf coast of Mexico, even the ironclad union positions are slipping away. Some roughnecks on the offshore rigs of the national oil company, Pemex, have not worked in months, and their voices are filled with anxiety.
“What do you think is going to happen?” some ask.
Pemex has been limping along for years, bleeding billions of dollars annually, saddled with debt and struggling to maintain production as its giant oil fields in the Gulf of Mexico run dry. Next year, it will pump less than two million barrels a day, the lowest output since 1980.
Fixing the oil company was already at the top of Mexico’s list of priorities, the focus of a long debate over the fate of one of its most important — and troubled — national institutions.
Now, that mammoth undertaking has become all the more critical with the United States’ election of Donald J. Trump. As Mexicans steel themselves for an American president who made upending his nation’s relationship with Mexico a cornerstone of his campaign, officials on this side of the border have hastened to reassure the country that Mexico’s economy is sound.
If Mr. Trump goes through with his promises to renegotiate the North American Free Trade Agreement, deport migrants and tax remittances to pay for his border wall, Mexico will face severe economic shocks, particularly to the vibrant manufacturing base, whose products replaced oil as the country’s main export years ago.
The Mexican peso remains at record lows. The central bank raised interest rates this month, citing “heightened uncertainty.” And last week, it cut growth forecasts for this year and next. The bank’s governor, Agustín Carstens, told a local radio station that understanding the Trump administration’s policies was “like trying to put a jigsaw puzzle together without having all the pieces.”
Many are pessimistic that the government can come up with a backup plan. “Mexico lacks a credible Plan B to offset the anti-trade wave,” analysts at Morgan Stanley warned in a recent note to investors.
The damage that Mr. Trump could inflict on the busy factories that ship cars and computers to the United States has given a sharp urgency to Mexico’s efforts to jump-start parts of the economy that do not rely on Nafta — particularly its dilapidated oil industry.
To that end, when José Antonio Meade, the finance minister, lists the Mexican economy’s strengths, he singles out the importance of the new energy laws that broke the 75-year monopoly held by Pemex.
The laws, part of a package of economic overhauls that President Enrique Peña Nieto pushed through Congress three years ago, allow for private investment in Mexico’s oil sector for the first time since foreign companies were expelled in 1938.
Only days before the American presidential election, Pemex’s chief executive, José Antonio González Anaya, presented a timetable of projects he expected to offer to potential partners and promised to begin returning the national oil company to solvency.
He and the finance minister met with investors in New York this month to argue that Mexico’s economy was solid and that “the oil sector will continue to be an engine of national economic growth,” according to a joint statement from Pemex and the Finance Ministry. The pair followed up with a visit to London.
Mr. Peña Nieto has pushed through other overhauls, including changesin education, telecommunications, taxes, electricity and finance, but they have yet to generate significant economic growth. Most economists project that the economy will expand by just over 2 percent this year.
The most radical of all these overhauls, though, was ending the monopoly of Pemex, the country’s largest company, and allowing it to seek capital and technology from private companies. The measure struck at Mexico’s most enduring symbol of national sovereignty, rejecting the long-held conviction that it could develop its most valuable natural resource on its own.
“The only way to bring back production in the next five, six years is to bring more investment to Pemex,” said Juan Carlos Zepeda, the president of the National Hydrocarbons Commission, Mexico’s oil regulator. “There is no other way.”
But after the new energy laws were approved, the company stalled, the promised joint ventures did not happen, and oil prices plunged.
Pemex reeled as its debt soared and production dropped. Falling oil revenue means oil funds less than 20 percent of the government budget, down from as much as 40 percent when prices were at their peak.
“The government was never prepared for sustained low oil prices,” said John Padilla, a managing director of IPD Latin America, an energy consulting firm. “They never saw a Pemex implosion in the way it occurred.”
The president chose Mr. González Anaya, a Harvard-educated economist known for efficiency, to take over at Pemex in February. He quickly announced the first joint venture proposal: a deepwater oil field just south of United States waters.
Experts believe that Mexico’s untapped deepwater oil fields are its next great prize. But they are risky and expensive, a concern at a time when low oil prices have forced international oil companies to scrap many planned investments.
Still, major companies like BP, Exxon Mobil, Chevron and Shell have qualified to bid in a deepwater auction in December.
In an interview in his office at the top of the Pemex tower in Mexico City, Mr. González Anaya warned not to expect too much.
“Some people have said to me, ‘Look, Pemex won’t go back to producing three million barrels.’ Well, no,” he said. “That’s a shame — but no. What I can say and demonstrate is the company’s solidity.”
Not everyone is sure that companies will jump at the chance to team up with Pemex.
“Two years ago, everybody wanted to partner with Pemex,” Mr. Padilla said. “They were being courted like the homecoming queen. Fast-forward two years later, and how can you go to your board and say, ‘Pemex is good for the money’?”
Another question is whether the government can speed up the transformation as a defense against Mr. Trump’s promised policies. Even if the government attracts private investment, the effect on production could take years to materialize.
“They’re not going to turn the economy around on energy reform,” said Jeremy M. Martin, an energy expert at the Institute of the Americas in San Diego.
In the meantime, Mexico must fix the company’s many problems.
Pemex’s rusty refineries operate at about 60 percent capacity, forcing the country to import more than half of its gasoline. The company loses billions of dollars every quarter, and it owes almost $100 billion in debt and an additional $68 billion in pension liabilities. Budget cuts have halted exploration for next year.
An explosion on a fuel tanker in September was the latest in a series of fiery and often fatal accidents. Gangs routinely tap Pemex’s pipelines to steal gasoline, tipped off from inside the company.
The government continues to tax Pemex heavily, and the oil workers’ union — an ally of Mr. Peña Nieto’s Institutional Revolutionary Party — remains powerful.
Mr. González Anaya’s first action after arriving at Pemex was to slash the budget by 22 percent, halting expensive projects and cutting waste.
“We haven’t finished,” he said. Referring to his effort to rein in overspending, he added, “We continue, continue, continue.”
For decades, Pemex made many people very rich. The company granted inflated contracts to local business executives who cultivated political connections, according to interviews with contractors in Ciudad del Carmen. Mayors in oil states demanded Pemex cash for public works.
“The budget has been converted into plunder,” said Mariano Ruiz Funes, a former Pemex chief of staff.
Analysts argue that Pemex may have to sell off parts of the company.
“We will see a much smaller Pemex in the years to come,” Mr. Ruiz Funes said, predicting a “long and painful” adjustment. “Politically it will be difficult.”
Mr. González Anaya is not prepared to make that decision.
Pemex “is not just any company,” he said. “You can’t ask a national oil company to be Exxon.”
But in Ciudad del Carmen, the riches of that national oil company are long gone. The city has lost about 23,000 jobs since the end of 2014.
“What we’re living through in Carmen, we have never lived through something like this in contemporary Mexico,” said José Domingo Berzunza, the economic development secretary for Campeche, the surrounding state.