1,668 km, 18 hours 10 mins1,036 mi, 18 hours 10 mins
The shortest driving distance is 554 km (344 miles).
The closest beach in the Gulf of Mexico to Mexico City is Tecolutla in the state of Veracruz, 380 Kilometers (236 miles) northwest of the city.
partly, not really most of it was gained through the Mexican war and the remainder was "bought" through the Gadsden purchase for 10 million dollars
I dont have the milage but there is a great page to get distance, roads, etc. Go to sct.gob.mx