“Europe feels spiritually dead and so does the United States,” Mr. Quemada-Díez said. “You end up wanting something else.”

He struggled to make sense of Mexico at first. Many foreigners do, complaining that the country is still a place of paradox, delays and promises never fulfilled for reasons never explained — a cultural clash that affects business of all kinds. “In California, there was one layer of subtext,” Mr. Quemada-Díez said. “Here there are 40 layers.”

Mexico’s immigrant population is still relatively small. Some officials estimate that four million foreigners have lived in Mexico over the past few years, but the 2010 census counted about one million, making around 1 percent of the country foreign-born compared with 13 percent in the United States. Many Mexicans, especially among the poor, see foreigners as novel and unfamiliar invaders.

Race, ethnicity and nationality matter. Most of the immigrants who have the resources or corporate sponsorship to gain legal residency here come from the United States and Europe. The thousands of Central American immigrants coming to Mexico without visas — to work on farms or in cities, or to get to the United States — are often greeted with beatings by the Mexican police or intense pressure to work for drug cartels. Koreans also say they often hear the xenophobic refrain, “Go back to your own country.”

Mr. Sánchez, the hair products salesman from Venezuela, said Mexicans who had not been able to rise above their economic class mostly seemed to resent the mobility of immigrants. In a country still scarred by the Spanish conquistadors, he said many of his Mexican neighbors responded with shock when they discovered that his younger sister was studying medicine at Mexico’s national university. Not that the quiet scorn is enough to deter him. “I earn more here in a year than I would in 10 years in my own country,” he said. “Mexicans don’t realize how great their country is.”

Many do, of course, especially those with experience elsewhere. Mexico has allowed dual nationality for more than a decade, and among the growing group of foreigners moving here are also young men and women born in Mexico to foreign parents, or who grew up abroad as the children of Mexicans. A globalized generation, they could live just about anywhere, but they are increasingly choosing Mexico.

Some are passionate idealists, like Luna Mancini, 27, a human rights lawyer working for the Supreme Court who was born in Mexico to Italian parents. After growing up in Barcelona, Spain, she returned to Mexico in 2009 because she felt that more could be done in Latin America, with law and with new tools of communication — digital video, social media — that encouraged grass-roots dialogue. Some, especially Mexican-Americans working in Mexico City’s hip culinary scene, have come here to reconnect with their roots. Others simply see Mexico as their best option, as an incubator for personal, professional and artistic growth.