For much of the last decade, Mexico and Brazil were a study in contrasts. "Brazil Takes Off" was a typical magazine cover, depicting Rio's huge statue of Christ literally blasting off. The equivalent story for Mexico was "The War Next Door: Why Mexico's Drug Violence is America's Problem Too."
In the past two years, however, the roles have been reversed. Riots in São Paulo and the downfall of billionaire Eike Batista have badly dented Brazil's glamorous image. Meanwhile, a succession of bold moves by Mexico's charismatic new president, Enrique Peña Nieto, have finally awakened foreign observers to the fact that Mexico is Latin America's new "country of the future."
Not only is Mexico's per capita GDP back above Brazil's, according to International Monetary Fund data, but over the past five years investors in the Mexican stock market have enjoyed nearly three times the returns of those who put their money into much-hyped Brazilian equities. Jobs are being created so fast in Mexico—more than two million since early 2010—that the problem of illegal immigration to the United States may soon be history.
In the 1980s and 1990s, Mexico was almost as well known for its financial crises as for its drug wars. Those days are gone. Although growth has been sluggish this year, thanks in large part to the troubles of the construction sector, the IMF predicts a rapid rebound between 2014 and 2018.
The catalyst for Mexican economic change has been political. In 2000, after 70 years of such complete dominance that Mario Vargas Llosa labeled it "the perfect dictatorship," the Institutional Revolutionary Party (PRI) lost power in free elections. Two successive center-right administrations under the National Action Party, or PAN, struggled to deliver the kind of radical changes that Mexico required. Instead, after a dozen long years in the political wilderness, the PRI renewed itself. In July 2012, it returned to power thanks to a highly effective campaign by Mr. Peña Nieto, the youthful former governor of Mexico State.
The democratic world today is so lacking in Mr. Peña Nieto's kind of strategic leadership that the visitor is rather taken aback to encounter it. The day after his inauguration, President Peña Nieto signed the so-called "Pact for Mexico," a framework pre-committing the PRI and its opponents—the PAN and the left-wing Party of Democratic Revolution (Partido de la Revolución Democrática)—to support key reforms in telecommunications, education and finance. It was a bold move, reminiscent of the 1977 Moncloa Pacts, which were the basis for Spain's transformation from Francoist pariah to integrated European democracy.
Then came a succession of confident initiatives. In February, the government arrested the teachers union leader, Elba Esther Gordillo, for alleged embezzlement. Most Mexicans had thought Ms. Gordillo—notorious for her French couture and villas in southern California—was untouchable. The final education reform bill, passed in September, was a still bigger blow against her union, creating independent teacher training institutes to replace the union-controlled university that had trained educators. The reform introduces performance testing to evaluate teachers and increases funding for new schools and learning centers.
The government also passed a telecom reform that most observers thought would never happen. The law boosts competition by encouraging new entrants to the telecom market with the ultimate goal of lowering prices for users. Raising income taxes on higher earners, as the new fiscal package does, is not too popular in the business community. Yet, it is politically smart for Mexico to invest in education and transportation infrastructure, while at the same time making the tax system more progressive.
Thanks to the "Pact for Mexico," the budget for 2014 easily passed last month. No government shutdown, no debt-ceiling drama (public debt is just 38% of GDP)—just agreement on the essential priorities.
Instead of compromising the independence of the central bank, as in Argentina or Venezuela, the Peña Nieto administration has diligently followed the recommendations of the Banco de Mexico to introduce deep structural reforms from education to antitrust laws. The government understands that only with consistently low inflation can the central bank keep interest rates low. In Mexico there is no wishful thinking that easy money could somehow substitute for real reform.
The most important project, however, is the liberalization of the energy industry, long held back by the state-owned Pemex monopoly. The same party that nationalized the country's oil fields 75 years ago is now embarking on a reform whose primary objective is to bring foreign capital and expertise back in. The PRI understands that only with outside assistance can the country develop its extensive shale resources and deep-water oil reserves. Many thought this reform would not pass, but the government delivered it ahead of schedule on Dec. 12.
Modern technology will take time to install. But thanks to the North American Free Trade Agreement—the fierce critics of which have gone silent—cheap U.S. natural gas will soon be flowing down north-to-south pipelines. This will make Mexican industry, which is already beating China on labor costs, even more competitive. That will in turn support a growing Mexican middle class.
The government has not lost sight of income inequality and low productivity. But Mr. Peña Nieto's key insight is that attacking the mere symptoms of economic underdevelopment is not the answer. It is rare indeed to witness a president talking about "raising family incomes for all Mexican families through elevating and democratizing productivity," as Mr. Peña Nieto said during his state of the union in September. If social ills like drug violence stem from a lack of opportunities, then successful economic reforms should reduce them. Almost all measures of violence have fallen during Mr. Peña Nieto's first year of government.
Even in a lousy year for emerging markets, Mexico has future prospects that are the brightest in the region. Under the revitalized PRI, the country is on its way to a new kind of institutional revolution: one that could permanently transform it from Latin America's laggard into North America's new engine of growth.
Mr. Barbieri is a former fellow at Harvard University's Belfer Center for Science and International Affairs. Mr. Ferguson is a professor of history at Harvard.