Peralta double captures gold for Mexico
Brazil, the hot favourites and desperate to win the only major football title to elude them, ended with the silver for the third time after Peralta's double - the first after 28 seconds - sent them crashing to defeat at Wembley.
Their players, who won all five matches scoring 15 goals on their way to the final, looked utterly crestfallen on the victory podium as their 60-year search for the Olympic gold, which looked certain to end here, continues at least until they host the 2016 Games in Rio de Janeiro.
The result threatens the position of coach Mano Menezes, who is also the boss of the senior side and hopes to be in charge when Brazil host the World Cup in two years time.
However he played down that idea afterwards, saying: "Any coach must be ready to suffer the consequences of his results, but I do not think this defeat will have a negative impact on the maturing process towards the World Cup in 2014.
"The World Cup at home in two years, remains our goal."
Mexico coach Luis Fernando Tena was naturally delighted.
"I don't know whether it is the greatest day in Mexico's football history but it is wonderful to know that Mexicans will be partying at home and in the United States, where they will be proud to be Mexicans," he said.
"I am so proud of my players, this is a truly great success."
Brazil's young side - the Olympics is essentially an under-23 competition with three over age players allowed - were stunned by Peralta's first minute goal which came after a mix-up between Sandro and Rafael.
They never really got back into the match until after half-time when the likes of Olympic poster boy Neymar, Oscar and Leandro Damiao began to click.
That was largely because of the influence of Hulk, who replaced Alex Sandro after 32 minutes because Brazil were forced to change their game plan, but they were certainly an improved side going forwards after the break.
However, Mexico, who beat them in a friendly before the Olympics, were never ruffled, defended well with Carlos Salcido impressive at the back and the tall shaven-headed Jorge Enriquez influential in midfield.
Even without their injured playmaker Giovani Dos Santos, they kept their composure and doubled their lead when Peralta powered in their second when he was left unmarked at a free-kick after 75 minutes and powered in a header, only minutes after having a goal ruled out for offside.
They also almost scored a spectacular goal too when Marco Fabian hit the bar with an overhead kick after Thiago Silva was caught in possession after 64 minutes.
They finally did concede late into added time when Hulk angled a shot home and then they survived a header from Oscar soon after when he should have equalised - but they held on for Mexico's first gold of the London Games and their first major international football title.
Their previous best Olympic performance was fourth place at the 1968 Mexico Games and their best World Cup performances came in the two World Cups they hosted in 1970 and 1986 when they reached the quarter-finals.
Their victory gave the CONCACAF region of North and Central America and the Caribbean a golden double at these Games with the United States winning the women's tournament, while Canada also finished as women's bronze medallists.
The attendance at Wembley of 86,162 was the highest for any event in London and took the total attendance for the men's and women's tournaments to a staggering 2.18 million.
The only controversy of the afternoon went largely unnoticed by most of those in the sun-drenched ground though.
Only 17 South Korean players were on the podium from their 18-man squad to collect their bronze medals after the IOC disqualified Park Jong-woo for displaying a political banner after they beat Japan 2-0 in the third-fourth playoff match at Cardiff on Friday.