Mexico does not have one single accent.
The country is huge, so speech in the north and the south can sound noticeably different.
In the north, the influence of the United States is stronger. You can hear more English loanwords in everyday speech.
Mexico City has its own recognizable urban variety of Spanish. It is often heard in the media, so it may sound familiar to foreigners.
On the coast, for example in Veracruz, speech may sound faster and softer.
In Yucatán, the influence of Maya can be heard. Sometimes it even affects intonation.
In Chiapas and Oaxaca, Spanish constantly exists alongside Indigenous languages. Because of this, local speech can sound quite different from the Spanish taught in standard courses.
Still, the answer to the question what language is spoken in Mexico remains fairly simple: first of all, Spanish.
But if you look a little closer, it becomes clear that Mexico is much more multilingual than it may seem. Nahuatl, Maya, Tzeltal, Tzotzil, Zapotec, and many other languages are still part of everyday life for millions of people.
That is what makes the linguistic picture of Mexico far more interesting than the simple answer, “They speak Spanish there.”