Predicting how many countries would back Mexico in a hypothetical US attack is impossible. Key factors:
Mexico has deep ties across Latin America (CELAC, OAS), Europe, Asia, and the Global South. These could mobilize political support.
An unprovoked, clear violation of the UN Charter would galvanize condemnation. A disputed border incident might split opinion.
US alliances (NATO, OAS, bilateral) could pressure allies to support Washington or stay neutral. Global power dynamics (China, Russia positions) would weigh heavily.
UN Security Council action would be vetoed by the US. General Assembly resolutions, ICJ proceedings, and regional bodies (OAS) would be the main arenas.
Mexico's trade integration (USMCA, Pacific Alliance) gives it economic ties that nations might protect.
Ultimately, support would depend on the specific scenario, international law interpretation, and geopolitical calculations—not a fixed number.