Mexico has two seasons: dry (November to April) and wet (May to October). The distinction matters more in some regions than others.
November to April is the best time for most of the country. Temperatures are mild, humidity is low, and rain is rare. This is peak tourist season — prices rise around Christmas, New Year, and Easter (Semana Santa), when Mexican families travel in large numbers and beach towns fill up. Book accommodation well ahead for those periods.
May to October brings afternoon showers to most of the country. In tropical areas — the Gulf coast, Chiapas, southern Oaxaca — the rain can be heavy and sustained. The Caribbean coast is vulnerable to hurricanes from August through October; September is the riskiest month. That said, rain usually comes in afternoon bursts rather than all-day downpours, and prices drop significantly outside July and August.
For specific regions:
The Yucatan Peninsula is best from December to February. Summers are brutally hot and humid, and hurricane season brings real risk to the Caribbean coast.
Mexico City and the central highlands sit at 2,200 metres and have a temperate climate year-round. Rainy season (June to September) brings afternoon showers but mornings are usually fine. The city is reliably pleasant from October through May.
Baja California is a desert peninsula with a mild climate most of the year. Summers are very hot in the interior. The Pacific side stays cooler than the Gulf of California coast.
Oaxaca and the south are pleasant from October to May. The valleys stay drier than the coast.
July and August see the most domestic tourism. If you prefer smaller crowds and lower prices, November (before the holiday rush) and late February to early April (after high season) are ideal.