I don't think they must have had a very good army. It seems like our wars with them always took about two days and they mostly always lost.
General Winfield Scott took an army of 12,000, went by sea down the coast, landed at Vera Cruz, took that city despite being highly outnumbered, went to Cerro Gordo and was victorious again despite being outnumbered.
He did the same at Contreros and Chururbusco. Same with Chapultepec Castle.
He went on to Mexico City, took that (though of course out numbered) and forced Mexico's surrender.and the Duke of Wellington declared him the greatest living general.
Mexico, dirt poor due to poor leadership sold off much of Northern Mexico to the Yanquis in the treaty of Guadalupe Hidalgo which reconquista types still whine about as a raw deal.