Enrique Peña Nieto, Mexico's president, greets attendees on March 18 during an event to celebrate the anniversary of the expropriation of Mexico's oil industry. (Susana Gonzalez/Bloomberg News)

When Mexican President Enrique Peña Nieto arrived at the March rally, he was greeted like a rock star. Hundreds of local residents and employees of Petróleos Mexicanos had gathered in the state of Veracruz to celebrate the 1938 expropriation of foreign oil wells and the founding of Pemex.

The workers, dressed in white shirts and guayaberas with the Pemex logo, leaned over waist-high barriers to try to touch the president. They cheered, breaking frequently into a chant normally reserved for the national soccer team.

An outsider would never have guessed that just three months earlier, Peña Nieto, 47, had signed into law a constitutional amendment that Pemex, its powerful union and its political backers had fought for decades. The amendment will open Mexican oil and gas fields to foreign and private investment for the first time in 76 years.

After signing the law Dec. 20, Peña Nieto told his countrymen that it would be a boon.

“We’ve decided to overcome the myths and taboos to take a great leap into the future,” he said. “A new history begins for our country.”

Yet at the March rally, he amplified the cheers by assuring the Pemex workers that none of their 153,000 colleagues would lose their jobs.

Pemex has always functioned as an arm of the state. It’s the biggest Mexican company and the country’s biggest taxpayer. In the final quarter of 2013, Pemex paid 50 percent of its revenue — $16 billion — in taxes to the federal government, which uses the state-owned company to fund a third of its budget. Pemex posted a loss of $5.8 billion for the quarter, bringing its total loss for 2013 to $13 billion. It lost $2.74 billion in the first quarter of 2014.

Mexico’s Congress approved a broad tax overhaul last year designed to increase collection of personal income and consumption taxes to begin to wean the government off Pemex revenue. Yet Pemex chief financial officer Mario Beauregard says company taxes will not be cut this year. And it will probably be years before enough new tax revenue from foreign oil drilling comes in to replace the lost tax levies from Pemex.

Edgar Rangel of Mexico’s National Hydrocarbons Commission, which oversees and regulates oil exploration, predicts that the opening of the country’s energy industry will bring in up to $30 billion of foreign investment annually and create as many as 2 million jobs.

The law’s approval prompted Moody’s Investors Service in February to raise Mexico’s credit rating one level to A3 from Baa1, saying it will help add about one percentage point to the country’s annual gross domestic product growth by 2018.

For Pemex, the constitutional change will mean it gets much-needed help in increasing its oil production, which has declined for nine years and in March hit its lowest monthly level since 1995.

For foreign oil giants such as Chevron, Exxon Mobil and Royal Dutch Shell, it means gaining access to untapped oil reserves that Pemex says could total 113 billion barrels, including 26.6 billion in the deep waters of the Gulf of Mexico. The reserves are worth $11 trillion.

Pemex chief Emilio Lozoya says Mexico also boasts 460 trillion cubic feet of unexploited shale gas in the rock formations beneath its soil, worth an estimated $2.2 trillion. Energy -policy scholar and consultant Kent Moors says the five major fields identified could produce a “shale frenzy” among private companies.

The foreign incursion into the oil and gas fields will begin this year after the Mexican Congress passes secondary legislation. The measure calls for foreign drillers to use Mexican suppliers for 25 percent of equipment and services by 2025. It proposes that the tax Pemex pays to the government be reduced over 10 years. The bill also relieves the Finance Ministry of its duty to approve the company’s budget. The sale of gasoline, now a Pemex monopoly, would open to competition.

‘All the cake’

Lourdes Melgar, a deputy energy minister, says Pemex probably lacks the financial and technical resources to operate all its existing fields efficiently, much less expand into new ones. Nevertheless, the company has told the government it wants to maintain control of most of its operations, with private companies joining it as junior partners.

“Pemex wants to eat all the cake, but it can’t,” Melgar said. “I think there will be gray areas where we will have to ask Pemex for more information and at some point tell them, ‘This one won’t work.’ ”

Mexico’s near-term goal is to raise production 20 percent, to more than 3 million barrels a day, by 2018. Delays in passage of the implementing legislation and the awarding of contracts makes that unlikely, says Maria Jose Hernandez of the Eurasia Group, a global risk consulting firm.

Peña Nieto’s plan is for Pemex to, in effect, cease to be a government department and function like a for-profit company. To further that goal, the government plans to allocate $28 billion to Pemex for oil exploration and production in 2014.

As part of the overhaul, the National Union of Mexican Oil Workers will relinquish its five seats on the Pemex board. The board will be trimmed to 10 members from 15 and will comprise five government officials selected by the president and five independent members, according to Pemex board member Fluvio Ruiz

The models for a new Pemex, Lozoya says, are Petróleo Brasileiro, the Brazilian oil major that opened to foreign competition in 1997; Norway’s Statoil; and Colombia’s Ecopetrol, which has seen production almost double since state control was limited in 2003.

“When you are the last one to the party, you can learn from other people’s mistakes,” says Juan Carlos Gay, a partner at Bain & Co. who has studied Mexico’s oil industry. “One thing that Pemex and the Mexican government should leverage is to use joint ventures in a smart way, which includes developing the expertise and capabilities of other companies.”

Pemex was born in a surge of nationalist sentiment during the presidency of Lázaro Cárdenas, who led Mexico from 1934 to 1940. On March 18, 1938, Cárdenas nationalized the country’s oil fields and seized the assets of Royal Dutch Shell and Standard Oil, both major U.S. suppliers of oil. The government monopoly on petroleum production was later enshrined in the constitution.

Mexico became a major oil exporter after the 1971 discovery of one of the world’s biggest oil fields in the shallow waters of the Bay of Campeche. The field was named Cantarell after the fisherman who alerted Pemex when he saw oil in the water.

Cantarell’s output has fallen almost 90 percent since 1979. That would have been a catastrophe for the government had the price of oil not increased to more than $100 a barrel during the past decade.

The failure of Pemex and its government overseers to invest in the latest drilling and exploration technology is partly to blame for the decline. A critical issue for the future of Pemex is manpower. The company is overstaffed with unskilled workers whose jobs are guaranteed for life and understaffed with engineers and skilled laborers, says Marcelo Mereles, a former Pemex director and now a partner at EnergeA, a consultancy.

‘Cultural handicap’

“Pemex continues to have a very big cultural handicap,” Mereles says. “The government has converted Pemex into a very bureaucratic company that operates like a government office and not like an international oil company.”

Pemex’s ability to compete with foreign companies will also be hampered by deficiencies in Mexico’s educational system.

“We’ve all heard the excellent news about Mexico’s great potential in the energy sector, but the question is, who’s going to do it?” said Rangel, of the hydrocarbons commission. “We have few universities committed to oil production, petrochemicals, chemical engineering or physics. And we produce few engineers.”

Until now, petroleum engineers’ main potential employer in Mexico was Pemex, and they could earn more money abroad.

Whoever does the drilling, one area of great potential for Mexico is its shale deposits. Victor Herrera, managing director for Latin America at Standard & Poor’s, says the petroleum embedded in shale is the “low-hanging fruit” of Mexico’s energy overhaul. “We could see a lot of investment coming very quickly from Texas.”

That’s because one so-far underexplored shale formation lies in northern Mexico across the border from Texas’s prolific Eagle Ford field. Oil output at Eagle Ford rose to 1.2 million barrels a day last year from about 50,000 in 2007.

The Mexican portion of the underground formation holds an estimated 3 billion barrels of oil and 4.2 trillion cubic meters of natural gas, according to Pemex. Company officials say it will need outside help to exploit any gas finds.

As President Peña Nieto put it to Pemex employees in March, “The energy reform is the most important economic change in Mexico in the last 50 years.”

The full version of this Bloomberg Markets article appears in the magazine’s June issue.