It boils down to city limits; either you use the city proper, which is the area within the legal city limits, or the greater metropolitan area, which usually includes other towns and communities that are part of the same urban conglomerate:
Mexico City proper: 1,485 km2 (573 sq mi) / 8.9 million inhabitants.Moscow proper: 2,511 km2 (970 sq mi) / 12.2 million inhabitants.Mexico City metropolitan area: 7,954 km2 (3071 sq mi) / 21.16 million inhabitants.Moscow metropolitan area: 4,662 km2 (1800 sq mi) / 16.8 million inhabitants.
If you consider the city proper for your calculations, Moscow is almost double the size of Mexico City. If you count the greater metropolitan area, Mexico City is bigger than Moscow by a hefty 50%
Related Q&A:
What is bigger Mexico city or London?-Well, let me tell you, Mexico City is way bigger than London. Mexico City is one of the largest cities in the world. It has a huge population and a vast area. The urban sprawl of Mexico City is massive. On the other hand, London is a significant and important city, but it doesn't compare in size to Mexico City. The infrastructure, the number of neighborhoods, and the overall scale of Mexico City make it much larger. So, there's no doubt that Mexico City takes the cake when it comes to size!