Updated

Mexico huddled after the final whistle and jumped up and down to celebrate its first Olympic gold medal in men's soccer.

It was a moment Brazil has lived five times in the World Cup, but never in the Olympic Games. For the third time in its history, Brazil settled for silver.

Oribe Peralta scored twice as Mexico edged Brazil, 2-1, on Saturday at Wembley Stadium. Peralta scored just 29 seconds into the match and added his second in the 75th minute.

"This is an unbelievable feeling," said Mexico midfielder Giovani dos Santos, who missed the match due to injury. "We are very happy because we worked very hard to be here."

Hulk scored in stoppage time for Brazil, which also lost the gold medal match in 1984 and 1988. Brazil claimed bronze in 1996 and 2008.

Brazil will try to end its drought in four years, when it hosts the Olympics.

"Brazil always have a big chance, but it is hard for us because we have never won (an Olympic gold)," Brazil defender Thiago Silva said.

For now, Mexico - which had never won a medal before - is the gold standard at the Olympics.

Peralta stunned Brazil less than 30 seconds into the game when he converted to the bottom-left corner. Teammate Javier Aquino forced a turnover and poked the ball to Peralta, who turned and made no mistake against goalkeeper Gabriel.

"They scored a goal at the beginning. When that happens you change everything you planned during the week. So in the end, it didn't happen as we expected," Thiago Silva said.

It was just the second goal in the first minute of a men's gold medal game and it was the difference for 75 minutes.

Although Brazil played well after the introduction of Hulk off the bench early in the game, it failed to test Mexico goalkeeper Jose de Jesus Corona.

Mexico nearly added to its lead early in the second half when Marco Fabian hit the crossbar, Peralta had a goal called back for offsides and Fabian lifted an open header over the bar.

Peralta made no mistake in the 75th as he easily circled away from Hulk in the area to reach a free kick from Fabian and, with no defender in sight, headed a perfect shot from 10 yards to the bottom-right corner.

In desperation mode, Brazil played its best and Hulk provided some hope with a goal one minute into stoppage time. He scored through the legs of Corona, and the Brazilians were not done.

Oscar, a recent signing for European champion Chelsea, had an open header from the corner of the 6-yard box, but fired just high in the third minute of added time on the last chance for Brazil.

With just seconds remaining, Mexico held on to set off a wild celebration. The Brazilians, meanwhile, were dejected as the gold slipped away once again.

"I feel sadness," Thiago Silva said. "But when you lose something, some good will come."