Mother Nature long coddled Mexico’s national oil company, blessing it with fountains of homegrown black gold. But in recent years she has gotten ornery, frustrating Petróleos Mexicanos with juicy but recalcitrant fields of oil. One day this spring she played a nasty joke. She unleashed a 6.4-magnitude earthquake on Mexico that caused the 50-story headquarters of the company known as Pemex to sway woozily, like an aging prizefighter struggling not to fall. Inside the iconic but timeworn building, the second-tallest in Mexico City, doors rocked on their hinges, metal blinds banged against windows, and frightened workers braced themselves inside door frames, hoping to ride out a threat they all knew was beyond their control.  Scant hours later, Pemex’s 39-year-old chief executive, Emilio Lozoya, sits at at the head of the massive conference table in his cloud-level office. The Pemex tower has stopped shaking, but the Pemex corporation faces a foundational challenge. In a move that has both shocked and thrilled the global oil industry, Mexico’s government is performing an about-face.  For the first time in three-quarters of a century, it intends to invite international oil firms into the country to sink their drills into its petroleum-rich earth. That decision has infuriated many Mexicans, and it fundamentally threatens Pemex, which has always been a monopoly. As the oil giants prepare to pounce, Lozoya, a Harvard-educated investment executive and an oil industry newcomer, has the task of whipping the bloated behemoth into competitive shape.  “It is, by all means, the most important transformation Pemex has suffered in our entire 76 years,” says the fresh-faced CEO, who speaks excellent English and chooses his words—including his verbs—deliberately. As he talks, he jots talking points onto a small white notepad that has been placed in front of his high-backed chair. By his right hand sits a red phone, a direct line to the office of Mexican President Enrique Peña Nieto, the oil reform’s architect and Lozoya’s friend and boss. Everything about Mexico’s energy opening is being carefully choreographed. But in Mexico’s rough-and-tumble energy business, even the most meticulous plans have a way of getting blown up.  Ever since 1938, when Mexico expropriated its gushing oilfields from foreign companies in a burst of revolutionary nationalism, that bounty has been off-limits to outside producers. The oil has been the exclusive purview of Pemex. Favored by geology as well as by law, the company has had the luxury of getting most of its oil from a couple of huge, easy-to-tap underground formations—known in the industry as “elephants.” Indeed, Pemex has become legendary in the oil world for its factory-like approach to pulling oil from a particularly Mexican type of elephant: fields in shallow water, just off the country’s Gulf coast. But along the way, Pemex has become notoriously inefficient. The company ranked No. 36 among the Fortune Global 500 last year, with revenue of $126 billion. But Pemex also posted a $13 billion net loss. The company is laden with bureaucracy, teeming with superfluous workers, and, by its own executives’ admission, thwarted by corruption. The result is both stunning and not very surprising: In a country that ranks ninth or 10th in global oil production, depending on who’s counting, and that some geologists say contains the largest unexplored petroleum area beyond the Arctic Circle, Pemex has presided over a steep decline in Mexico’s oil output.  That decline—Mexico’s oil production has tanked 25% over the past decade, to 2 million barrels per day—threatens the country’s ability to pay its bills. Pemex’s oil revenue is the single biggest contributor to the Mexican treasury, supplying roughly one third of the national budget. It’s doubly embarrassing for this proud country because it comes as an oil boom is exploding next door in the U.S. That’s why Mexico now is rolling out the red carpet for the international oil firms it once threw out.  If it works, foreign players ranging from super-majors to wildcatters will pour into Mexico and pull up the crude and natural gas that Pemex has failed to tap from Mexico’s increasingly technically challenging fields. Pemex will be guaranteed favored-son status, granted an initial slate of fields in a much-anticipated government decision known as Round Zero that was to be unveiled as this issue went to press. But unless Pemex can prove itself competitive, it will be largely relegated to the relatively simple fields it has learned to exploit well, while foreign companies will dominate the vaster troves of Mexico’s harder-to-get hydrocarbons, from the deep waters of the Gulf of Mexico to shale plays near the U.S. border. The government hopes this race will boost the amount of Mexican oil that flows onto the market—raising the take for the state, which will get a cut of every barrel. Equally important, it hopes the surge in Mexican oil and gas production will have a raft of spillover benefits for the country, slashing electricity prices, attracting industry, and bankrolling services for the people.  But whether Mexico rocks the energy world will depend on whether it can execute its pledge to reform Pemex, a sprawling bureaucracy that for generations has had its hands in every aspect of the country’s oil sector. A few months in, the attempt is hitting major roadblocks. The difficulty is partly that Pemex is a poster child for corporate dysfunction. It’s also that Pemex, however dysfunctional, is seen by much of the Mexican public as the guardian of the nation’s patrimony.  Everywhere it sits, oil is big business. In Mexico it’s a cultural keystone. Haydee Figueroa, a dentist working one afternoon on her iPad at a café in Polanco, a tony district of the capital, serves up a pithy summation: In Mexico, she says, “oil represents something similar to corn.”  March 18, the day Mexico’s revolutionary government grabbed the country’s oilfields from the gringos in 1938, is a national holiday. The event is a key element in Mexican schoolbooks and part of the country’s stick-it-to-the-man folklore. Pemex is the most recognizable brand in the country; its gas stations, painted in the national colors, green, white, and red, are the only mainstream places in Mexico to fill up a tank, and the government-subsidized prices don’t vary from pump to pump. The Pemex empire is by far the country’s biggest employer, providing paychecks to more than 150,000 Mexicans; it operates a network of hospitals, recreation centers, and libraries; and it has made not a few influential Mexicans very rich.  Source: PEMEX; EIA; Mexico National Hydrocarbons Commision  Adrian Lajous was Pemex’s CEO in the late 1990s and remains deeply involved in the country’s energy debate. One recent afternoon, dressed in a tweed jacket and jeans in the living room of his book-lined, modernist Mexico City house, he delivered a lecture on Mexico’s oil history. “We copied the U.S.,” he says, “but here, it was the wild, wild West.”  Petroleum was discovered in Mexico in the late 1800s, and production ramped up between 1900 and 1910. Almost immediately, Lajous explains, “you just had these fields spurting oil.” Oil companies, notably from the U.S. and England, set up shop. In 1910 the Mexican Revolution broke out, yet oil production kept rising. “The oil companies simply paid off all the factions in the civil war,” Lajous says, “and they were protected.”  After the Mexican Revolution ended in 1920, the trade union movement in Mexico gathered steam. In 1937 oil workers walked off the fields on strike, protesting their pay. In March 1938, Mexico’s supreme court sided with the workers; days later Mexican President Lázaro Cárdenas declared the country’s oil the property and business of the state. With Cárdenas’s declaration—a moment known ever since in Mexico simply as la expropiación, or the expropriation—Pemex was born. In the lobby of the Pemex tower today, 44 stories under Emilio Lozoya’s chair, stands a larger-than-life bronze statue of a triumphant Cárdenas, the populist who launched the firm.  One good way to understand the intensity of feeling about oil in Mexico is to wander around the National Museum of Anthropology, an architecturally stark building each of whose rooms displays artifacts from a different Mesoamerican culture. A common narrative unites many of the displays: A resource-rich Mexico is invaded and exploited by greedy foreigners, and then its heroes rise up against the outsiders, sometimes forcing them out and sometimes being martyred in the attempt. In the Aztec room an exhibit explains that Hernán Cortés, the Spanish explorer who arrived in Mexico in 1519, killed Moctezuma II, the Aztec leader, which ultimately led to the ascension of Cuauhtémoc as the Aztecs’ head.  On a rainy Saturday morning, standing in the Aztec room and speaking to a crowd of mostly European visitors, tour guide Julieta López distills the story to what she sees as its essence: The Spanish invaders “used knowledge to manipulate the people, just as, today, we are manipulated.” Later, asked about her view of the energy reforms, she offers a similar critique. “I am completely against the reforms,” she says. “It took us a long time to get rid of the foreigners. Now this President wants to open the doors to have them come again.”  MEXICO – CIRCA 1956: Pemex filling station. Mexico, January 1956.Roger Viollet/Getty Images  It’s a consensus view on the Mexican left. Ursus Sartoris is a Mexico City poet, editor of a literary magazine, and self-described leftist activist. He has wild brown hair, sees the world through thick, black-rimmed glasses, and wears suspenders over a belly that betrays his fondness for good food. One evening in Mexico City, sipping red wine and munching a corned-beef sandwich in a French café, he spins a parable. It likens Pemex not to an elephant but to another four-legged creature.  “You have a cow,” says the poet. “For a long time this cow produced a lot of milk. And then some guy comes and says, ‘You have a very nice cow. I want that. Sell it to me.’ And you say, ‘No, this is for my small farm, because from this cow all my family eats.’ And he says, ‘No, please sell me the cow.’ The cow is Pemex.”  The cow may be past its prime, but it still belongs to the family. “The relationship between Pemex and the Mexican people is very complex,” says Fluvio Ruiz, an energy economist who had invited his friend Sartoris to dinner that evening. “People say it’s dirty and corrupt. But it’s our dirty and corrupt.”  Ruiz’s own relationship to Pemex is a study in those contradictions. He is, he notes, a niño Pemex, or child of Pemex. He grew up in the Pemex petrochemical town of Coatzacoalcos, the son of a lawyer and a teacher, both of whom worked for Pemex. He spent his college days in the late 1980s in student protests, agitating for Mexican political reform. Today, as a result of an earlier attempt to reform Pemex that effectively set aside four board seats for people picked by Mexico’s leading political parties, the bushy-haired agitator has an unlikely job as a full-time, salaried Pemex director. Posters of Che Guevara, Lenin, and Marx cover the walls of his office—a capacious suite on the Pemex tower’s 14th floor. The intellectual, who wears colorful rope bracelets on his wrist, is ferried around Mexico City in a gray Nissan Pathfinder supplied by Pemex and driven by a chauffeur. He sees reforming Pemex as necessary to saving it—and his mission as helping shape the reforms so that they strengthen the company rather than snuff it out. “The main problem, the base of it all,” he says, “is that Pemex is not a company. Pemex is a public organism.”  Sergio Guaso’s daily life is a testament to the frustrations of Pemex’s position as an ossified arm of the state. Guaso, a no-nonsense, ruddy-faced man, wears monogrammed white shirts and works at a desk with nothing on it but his laptop. He is vice president of business development for Pemex’s exploration and production division, a job for which he travels a lot. When he files his expenses he often isn’t paid for three months. Why? “No other reason than bureaucracy,” he says in his barren office. “Many desks, many people, the same paper.”  Mexican law imposes many restrictions on how, when, and in what quantity Pemex can spend money. The rationale is that Pemex is just another government agency, competing with others for its annual slice of the federal fiscal pie. But Pemex doesn’t just consume government money; it also supplies a good chunk of it. If there’s one common refrain within Pemex’s C-suite, it’s that this short-term outlook by government bean counters all but ensures that Pemex will stumble in the long-term business of producing oil.  Guaso ticks off example after example of those inefficiencies. Mexican law, for instance, limits the amount of debt Pemex can incur. But it eases that limit for debt that Pemex certifies it can repay within a year. So Pemex focuses on incremental improvements to its existing fields rather than less immediate—but necessary—bets on new fields. In short, it keeps riding its elephants until they drop.  Pemex can’t pin all its shortcomings on a federal fiscal straitjacket. Exhibit A of the company’s own failures is a fiasco at one of Mexico’s juiciest oil formations, an elephant called Chicontepec. It’s enormous, and it contains one-third of all the certified oil and gas reserves, or hydrocarbons in the ground, that Mexico currently claims. Chicontepec was discovered nearly a century ago but has remained largely undeveloped. At the most basic level, that’s because its oil, mostly heavy and lurking in countless tiny pockets, is hard to reach.  Pemex began prioritizing Chicontepec in the early 2000s, roughly when Mexico’s most prolific field, a legendary elephant called Cantarell, was heading into decline. By 2005, Pemex had bored a few hundred wells. Those results were encouraging, and over the next several years Pemex announced inc00reasingly bullish plans to develop the formation. But it soon ran into a buzz saw: Mexico’s oil regulator, the National Hydrocarbons Commission, which the government created in 2008 largely out of frustration with Pemex’s declining output. The commission’s mandate was to get Pemex’s production up again.  The new commission disputed the amount of oil reserves Pemex was claiming from Chicontepec. Reserves are a crucial metric the market uses to judge an oil company’s health, and strict international rules govern their tabulation. One rule is that, to be counted as reserves, an oil deposit must be “economic.” That means the company asking to book the oil must show that developing it would bring sufficient financial returns to justify the effort.  At Chicontepec “we had doubts about this production being economic,” explains Edgar Rangel, a commission member. Like most employees of the commission—indeed, like many of the top players in today’s fast-moving Mexican oil scene—he’s young, well educated, convinced he’s helping his country at a formative moment, and therefore brash. One reason the commission “started to be suspicious,” he says one afternoon, sipping lemonade at a Mexico City café, is that although Pemex had hired third parties to certify its reserves claims, Pemex “would keep the reports of the certifying companies in a drawer, locked up.” When the commission got hold of the reports, it found “huge discrepancies” between the numbers the certifiers gave and the numbers Pemex claimed, Rangel says. “But Pemex would hold to its numbers. They says, ‘We’re correct.’”  Mexico’s state-run oil monopoly Pemex’s platform “Ku Maloob Zaap” is seen in the Northeast Marine Region of Pemex Exploration and Production in the Bay of Campeche April 19, 2013. © Victor Ruiz / Reuters REUTERS  In 2010 the commission issued a public report that put an asterisk by Pemex’s reserves numbers. It counted only some Chicontepec oil as economic, labeling the rest as technically but not necessarily economically possible. “Pemex was, as you can imagine, extremely unhappy,” says Rangel, who once worked at the oil giant. “I believe that I lost eight to 10 friends” as a result of the dispute.  Reserves are only a theoretical measure of an oil company’s prospects. What’s incontrovertible is oil production. In early 2013, Pemex expected to pull 94,000 barrels of oil a day out of Chicontepec by the end of that year. Today it’s producing far less.  Part of the blame lies with the geologists Pemex relied on. Committing an error of extrapolation, they figured the entire formation looked similar to the area plumbed by the initial wells. Instead, Pemex later discovered, the formation varies hugely from spot to spot, so it will require a variety of sophisticated and costly techniques to get out the oil. “From the limited information we had at the time,” says Gustavo Hernández, Pemex’s head of exploration and development, “we were expecting more production.”  It wasn’t just Pemex scientists who fumbled Chicontepec. Pemex managers did too. In the past few years Pemex has hired outside companies to try different methods to get at Chicontepec’s oil. Pemex has spent about $3.5 billion on those attempts, and thus far it has little to show for it. The root of the problem, Hernández says, is that Pemex’s Chicontepec managers flouted Pemex policy and paid the companies merely for drilling wells, rather than predicating payment for the drilling on finding oil. “They didn’t drill smart holes,” he says, “because the incentive was just well completion, not additional production.”  As a result of the Chicontepec experience, heads at Pemex have rolled. Lozoya, the CEO, describes his response upon learning of the financial blowout this way: “Firing some people, moving some people. But you know what? Very honestly, I cannot look to the past. I need to look to the future.”  For Mexico that future rests on bringing in foreign oil companies with technical expertise. Executives of several of those companies—some of the biggest oil producers in the world—declined to comment, fearful of offending the government and imperiling their hopes of landing permission to pull up and sell off some of Mexico’s oil. Like a thick steak, that prize is so big they can taste it.  One outside oilman who did agree to talk is Harry Bockmeulen, at the time Mexico director for Petrofac, a London-based firm that has operated for several years as a Pemex contractor. It has been paid a fee by the Mexican giant to help it squeeze more oil from its aging fields. What Petrofac and the world’s biggest oil companies anticipate under Mexico’s reforms is something more profitable: the freedom to bid on Mexican fields and sell the oil they produce.  Bockmeulen has watched this movie before. He has spent much of his career stationed in oil-rich Latin American countries, positioning his employer to snag a piece of the local action at whatever moment it opens up. All the big international oil firms “will have a cut in the new regime” in Mexico, he predicts, chatting on a Sunday morning hours after flying back to Mexico City from Europe. “The resource is here,” he says, his cheeks flecked with a day’s gray stubble. “And we always go to where the resource is, don’t we?”  Lozoya, the young CEO, is moving to gird Pemex for battle. He is flattening the company’s four main operating units into two, because traditionally, he says, the heads of each unit “don’t care” if another unit is losing money, “as long as their [own] numbers are fine.” From there, he wants to rationalize Pemex’s refinery business, which is bleeding billions.  Pemex CEO Emilio LozoyaALFREDO ESTRELLA—AFP/Getty Images  More grandly, he wants to lay new oil and gas pipelines across his country and beyond it—pipes he asserts could modernize all of Central America. He gets up from his conference table, walks over to his desk, and grabs a not yet public map of his pipeline plans.  One priority, he says, is to use a north-south pipeline at the narrowest point in the country between the Gulf of Mexico and the Pacific Ocean to send increasing amounts of Mexico’s oil west to China, other parts of Asia, and California. Another is to build a pipeline ferrying Mexican oil and gas down to Guatemala and beyond. “Think about the impact this will have on immigration,” he says. “It will create a much more competitive region.”  But for Lozoya to construct Pemex 2.0, he’ll have to get his hands on a lot more oil. That has set up a power play between Pemex and its owner, the Mexican government. The government’s priority is to boost Mexico’s oil and gas production, maximizing the national rent. Pemex’s goal is to raise its corporate take. That means Pemex is gunning for authority to drill as many of Mexico’s fields as it can. The fight is over whether Pemex will be the most efficient producer.  The government was to announce in August which fields it would give Pemex and which fields it would, over the next several years, open for bidding to outside companies. Both sides have long agreed that Pemex should get most of Mexico’s shallow-water fields and conventional onshore fields—Pemex’s traditional bread and butter. But Pemex also asked for sizeable chunks of the deepwater Gulf of Mexico, which it has begun drilling, and of Mexico’s extensive though undeveloped shale plays. “My concern is they’re asking for too much in areas where they don’t have the technical expertise,” says María de Lourdes Melgar Palacios, undersecretary for hydrocarbons in Mexico’s energy ministry.  All this talk of clipping Pemex’s wings is contemptible to the son of the man who engineered la expropiación in 1938. At age 80, Cuauhtémoc Cárdenas, son of the late Lázaro Cárdenas and namesake of the Aztec chief, is trying to engineer his own revolution: a plebiscite to roll back what he sees as the auctioning of the nation’s wealth.  One evening Cárdenas chats on a white couch in his office, in the walled compound that once was his parents’ house. His shelves hold books about Simón Bolívar and other Latin American fighters, and a huge oil painting of his father hangs on a wall. Outside, under the porte-cochère, sits his father’s 1966 brown Oldsmobile, as if parked in time. The son pronounces the current reforms both “a big mistake” and “a violation of the law.”  Cárdenas and his colleagues are working to collect signatures to force a public vote to negate the oil reforms at the country’s next election, to be held next year. He says that as of last spring his movement had collected 1.7 million signatures, and that it was trying for 1.5 million more. That sets up a race against the clock. While Cárdenas and the left try to roll back the reforms, which the Mexican legislature approved in August, Peña Nieto’s government is scrambling to implement them. “We are in a hurry. We cannot delay,” says Javier Treviño, a Mexican congressman who’s helping lead that push on behalf of the president.  Treviño, speaking in the bar of Mexico City’s Four Seasons hotel, brushes off the left’s opposition as naive and outdated. “They still want to have Mexico as the vision of oil nationalism. They are very parochial,” he says, fingering his BlackBerry. In particular, the Mexican left doesn’t fully grasp that oil companies have many spots around the world where they can go to hunt for crude, Treviño asserts. “We are not the only dish at the table.”  Hanging over the push to reform Mexico’s oil and gas sector like a storm cloud is fear about the energy boom already exploding north of the border. The U.S. long has been the biggest buyer of Mexican oil exports, but lately its purchases have fallen sharply, in part because private oil companies have succeeded stupendously in squeezing more oil from U.S. shale. And U.S. imports probably will fall a good deal further if Washington approves the Keystone XL Pipeline, a controversial tube that would move Canadian crude to many of the same U.S. Gulf Coast refineries that now process tankersful of Mexican oil. The world has shrunk, and the easy elephants have been shot, in the nearly 80 years since an ascendant, post-revolutionary Mexico had the bravado to tell the foreign oilmen to go home. Today, though it pains many in Mexico to admit it, the country needs cutting-edge technical help to convert its prolific fossil-fuel resources into cash. The real question is whether Mexico has the muscle to carry out its reforms so that this time the oil and gas produced by the international drillers ends up, for the long haul, enriching the country.  This story is from the September 1, 2014 issue of Fortune.
Seventy-six years after nationalizing its oil business, Mexico invites foreign companies back to drill. What will it mean for mighty PEMEX—and for the nation's self-image?