"Therefore we recommend that your passport, regardless of country of origin, should be valid for a minimum period of six months, however long you intend to stay to avoid any potential problems at the port of entry.
Immigration authorities at the port of entry may allow or deny entry of any person into Mexico. If you have a passport that is valid for less than six months and you intend to stay in Mexico for a short period of time —perhaps a vacation— the Immigration Officer might allow you entry, especially if you can show a return air ticket."
https://www.mexperience.com/mexico-essentials/mexico-entry-requirements/#ReqRes