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.


“We want the people in Mexico to believe in this young generation of players,” forward Giovani dos Santos said. “This gold medal goes to all of those in Mexico who always believed in us. For those who didn’t believe in us? Well, let them celebrate too.”


For Brazil, there was only anguish and no small measure of shock. The Brazilian team was loaded with stars. Many of the players are already playing club soccer for top European teams like A.C. Milan, Manchester United, Inter and Real Madrid. Others who still play in Brazil, such as Neymar, are coveted by teams worldwide.


By comparison, the Mexico had only one player on its roster who does not play in the Mexican league and that player — dos Santos, who plays for England’s Tottenham Hotspur — was hurt in the semifinal and did not play Saturday.


It did not matter. Mexico, which has suffered difficult defeats in previous forays deep into international tournaments, was the better team throughout. This victory will not erase the painful memories of matches like the 1986 World Cup quarterfinal loss to Germany on home soil, but it will certainly be celebrated, surpassing even the victory in the 1999 Confederations Cup, an eight-team tournament featuring the champions of each of FIFA’s geographic regions.


“We just entered the history books of Mexican sport,” Marco Fabian said. “We have given our people an immense joy. This is unforgettable.”


There is no reason to think there will not be more days like this for Mexico. Last week, Sunil Gulati, the president of the United States Soccer Federation, told reporters that he had taken note in recent years of Mexico’s dedication to player development.


Gulati specifically mentioned some rules implemented in the Mexican leagues that required each team to allot a certain number of minutes per match to young players. Fruits of that commitment, Gulati said, could already be seen: In 2011, Mexico finished in third place at the Under-20 World Cup and won the title at the Under-17 World Cup.


So it was not surprising to see Mexico thrive as well at the Olympics, which is essentially an under-23 tournament (save for three exceptions per team).


For Brazil, the disappointment was obvious. Neymar lay on the field, despondent, for several minutes after the final whistle. At the medal ceremony, many of the Brazilian players did not even look at their silver medals. Brazilian legends like Romário and Ronaldo never won gold, but this group was confident. Brazil last reached the final at the 1988 Games, where it lost to the former Soviet Union, and to deliver the country’s first Olympic gold in men’s soccer, Neymar said at one point, “would be a great honor.”


He was left instead with disappointment. “I feel very sad right now,” he said.


Brazilian Coach Mano Menezes admitted that Mexico was the superior team Saturday, a relatively stunning concession. While most countries used a youth national team coach at the Olympics, Menezes is Brazil’s senior national team coach and the roster he brought here will likely be similar to the one Brazil will use in 2014 when it hosts the World Cup.


Mexico, however, was clearly not intimidated by the Brazilians’ collective pedigree. Just half a minute into the game, Mexican midfielder Javier Aquino pressured Rafael, who tried to slide a pass backward to escape. Peralta quickly read the play, jumped in front of the pass and smashed a shot past the Brazilian goalkeeper, Gabriel. Before most of the Brazilians had even touched the ball, they were down a goal.


Mexico continued to press the game and the Brazilians — who had scored three goals in each of their five previous games — squandered their chances in front of goal. When Peralta scored again in the 75th minute, firmly heading home a free kick cross from the wing, Brazil’s hopes were essentially squashed.


There was a moment or two of tension from Mexico as Hulk managed to pull a goal back in the first minute of added time but two minutes later — after one more miss from Oscar — the referee Mark Clattenburg blew the final whistle. The Mexican players wrapped their arms around each other at midfield, dancing and singing as the Brazilians could do nothing but stare.


“This is incredible,” Mexico defender Carlos Salcido said. “I have already bitten the medal and I can tell you it is real.”