There is now an automated entry procedure at MEX. No human contact. First, you scan your passport picture page. Then the machine takes your picture. Third, the machine delivers a 6-month visa to you and out you go.
If your passport expires within six months then you still have to visit an immigration officer. That officer wants to know your date of departure and will give you a visa ending on that date.
The new procedure is only available to visitors from US and Canada and to reentering Mexicans.