LONDON — On one side of the field the Brazilian soccer prodigy Neymar fell in despair. On the other, the Mexican defender Diego Reyes dropped to the ground with glee. One was despondent that he could not be part of making history; the other was floored that he had.

Mexico, a decided underdog, won the country’s first Olympic gold medal at the London Games — and first significant international soccer trophy of any kind — with a lively 2-1 victory over Brazil at Wembley Stadium on Saturday. Oribe Peralta scored the first goal of the game just 28 seconds in, then added a second 15 minutes from full time to set off a wild and raucous celebration from the Mexican fans, who have craved global success for so long.

The victory is likely to be hailed by many Mexicans as the greatest ever for the national team, and it will also serve as another reminder of the gap in quality between Mexico and the United States at the younger level: The United States failed to qualify for the men’s Olympic tournament while Mexico overcame an injury to its best player to stun one of soccer’s world powers in the gold medal match.

Combined with several other recent accomplishments in major age-restricted international tournaments, the future appears exceptionally promising for Mexico, the Americans’ major rival.