An even match was decided by goals at either end of the second half from Sofia Huerta and Olivia Jimenez, the latter a stunning strike from distance.
There were chances at regular intervals throughout the contest with Switzerland failing to convert through Carmen Pulver and Cora Caneta, while Mexico did likewise, notably on two occasions through the lively Huerta.
Almost immediately after the interval a long ball from defender Arianna Romero caught the Swiss defence flat-footed and Huerta was able to hold off a defender and shoot powerfully into the net.
Switzerland enjoyed more of the possession and openings as the contest wore on but were unable to convert several chances, notably through Pulver who was denied by an excellent block from goalkeeper Cecilia Santiago.
Swiss hopes, however, were killed off in injury time when substitute Jimenez laid claim to one of the goals of the tournament, with a powerful drive on the run from the best part of 35 metres.
Switzerland became the first team to be eliminated at Japan 2012, following the draw between New Zealand and the host nation later in the evening.
“We played a very good game and we deserved to win,” said Mexico coach Leonardo Cuellar. “Now we have to prepare for the next match because it is crucial. My aim is to make my team continue to grow and to play the kind of football they're expected to play."