Mexico the country, Mexico the state, and Mexico City. When you hear "Mexico" elsewhere in the world most of the time people mean the country. When you hear "Mexico" within the country of Mexico then people probably are referring to the city. The city is surronded by the state but is in its own federal district
When I checked into the hotel in Mexico City I was asked, "Is this your first time in Mexico?" I responded with a "yes" because of my time spent in the Yucatan Peninsula exploring the abandoned Mayan city of Tulum. But this was my first time in Mexico City. However, the hotel desk clerk did not mean Mexico the country but rather Mexico City, also referred to as DF (pronounced 'day f-A') meaning federal district. Her response of "Oh, then you really don't need a map of downtown" confirmed what she meant.
One must know that there are really three things that can be called México. There is the country which official name is the United Mexican States (Estados Unidos Mexicanos), there is the state of Mexico (Estado de México, often refered to as Endomex), and then there is Mexico City (Ciudad de México) which is the land mass of the Federal District (Districto Federal).
Within the United Mexican States, if a person is not talking about international events such as soccer, then they are probably referring to the city. Historically this is because the country obtained the name from the city because before independence the region was called New Spain. Now the the city is without a doubt Mexico's primate city which dominates the commanding heights of the country (there can be an agreement that the north with its economic ties to the United States and the south being undeveloped are culturally free of Mexico City but there can be no doubt Mexico cannot function without Mexico City). Having officially about 18% of Mexico's population (but more likely over 20% because of the amount of Mexicans living legally and illegally in the United States) makes the city the demographic mammoth of the country.
When people inside Mexico want to refer to the country they use the terms La República (the republic) or La Patria (the fatherland).
It can be said that having Mexico City be such a primate city is unhealthy for the country. Mexico City eats up many of the resources that leaves much of the rest of the country impoverished. A friend stated that the relationship between the city and the country is New York City's to New York state only to a much greater and obscene extreme. This trend was heightened by Presidents Benito Juarez and Porfirio Díaz and the Institutional Revolutionary Party by their centralizing the politics and culture of the country on and in Mexico City.
For previous versus posts read England versus Great Britain versus the United Kingdom, Netherlands versus the Netherlands, nation versus state versus nation-state, and Hawaii versus Hawai'i