MONTERREY, Mexico — Visiting Mexico this past week reminded me of one of my favorite quotes from my days in Beirut. It was when a hostess asked her dinner guests during the Lebanese civil war: “Would you like to eat now or wait for the cease-fire?”

One of the lessons of both Mexico and Lebanon is how irrepressible is the human spirit — that no matter how violent a country becomes, people will adapt and take risks to innovate or to make profits or get to school or to just have fun.

That is a key reason that Mexico is making something of a comeback these days. Whether it will make it back in a sustainable way is unclear. Mexico still has huge problems: stifling monopolies in energy, telecom and media; a weak K-12 education system; violent cartels; and a corrupt police and judiciary. Together, they will keep a lid on Mexico’s prospects if they’re not addressed, the human spirit notwithstanding.

That said, it’s useful to look at what Mexico has gotten right, despite its problems. The first two had to do with actions by the government — improved higher education and macroeconomic policy. The third happened naturally. It’s when a critical mass of youth “just don’t get the word” — they don’t get the word that the government is a mess or that China is going to eat their lunch or that the streets are too dangerous. Instead, they take advantage of how the Internet and globalization promote individual empowerment and opportunities to start stuff and collaborate on stuff really cheaply — and they just do it. Let’s look at all three.

According to the Inter-American Development Bank: Despite Mexico’s weakness in K-12 education, in the past 10 years, Mexico doubled its number of public education institutions at the postsecondary level, and many are dedicated to science and technology. It now graduates many more engineers.

On Sept. 19, The Financial Times reported: “According to UNESCO, the number of engineers, architects and others in disciplines related to manufacturing graduating from Mexican universities has risen from almost 0.4 per 1,000 people in 1999 to more than 0.8 today. ... The number for the U.S. over the same period has remained roughly flat at 0.6 per 1,000.”

That is a reason that Mexico in 2012 became one of the largest exporters of information technology services in the world, approaching the likes of India, the Philippines and China.

As for economics, Richard Fisher, president of the Federal Reserve Bank of Dallas, summed it up in a Nov. 2 speech, when he said of Mexico: “Between 1975 and 2000, there was one crisis after another: in 1976, 1982, 1985-88 and 1994.” But thanks to a series of monetary and fiscal reforms, Fisher argued, the Mexican economy’s vital signs look a lot healthier.

“The U.S. deficit is 7 percent of gross domestic product,” said Fisher. “Mexico’s deficit is about 2 percent of their GDP.” Meanwhile, he added, the U.S. “is growing slowly, weighed down by debt and the pervasive uncertainty caused by our nation’s fiscal imbalances and growing regulatory complexity. Mexico, in contrast, is growing robustly, and, in contrast to their Washington counterparts, Mexican policymakers are demonstrating remarkable commitment to fiscal discipline.”

As for Mexico’s “just do it” generation, I’d put it this way: Monterrey has tens of thousands of poor living in shantytowns. They’ve been there for decades. What is new, though, is that this city, Mexico’s Silicon Valley, now also has a critical mass of young, confident innovators trying to solve Mexico’s problems, by leveraging technology and globalization.

I met a few of them: There was Raul Maldonado, founder of Enova, which has created an after-school program of blended learning — teacher plus Internet — to teach math and reading to poor kids and computer literacy to adults. “We’ve graduated 80,000 people in the last three years,” he told me. “We plan to start 700 centers in the next three years and reach 6 million people in the next five.”

There was Patricio Zambrano from Alivio Capital who has created a network of dental, optical and hearing aid clinics to provide low-cost alternatives for all three, plus loans for hospital care for people without insurance. There was Andres Munoz Jr. from Energryn, who demonstrated his solar hot-water heater that also purified water and could cook meat.

There was the administrator from Cedim, a startup university offering a “master’s in business innovation.” And there was Arturo Galvan, founder of Naranya, a mobile Internet company that offers a range of services, including micropayments for consumers at the bottom of the pyramid.

“We’ve all been here for many years, but I think that the confidence is starting to happen,” said Galvan. “You start to see the role models who started from zero and are now going public. We are pretty creative. We had to face a lot of challenges,” As a result, he added, “we are strong now, we believe, and the innovation ecosystem is happening.”

Naranya is based on the Spanish word for “orange,” or naranja. Why that name? I asked Galvan. “‘Apple’ was already taken,” he said.