The Brazilians got off to an inauspicious start when they conceded a goal by Mexico's Oribe Peralta in the first minute of the game. Peralta headed the ball in for a crucial second goal with 75 minutes gone.
Brazil came back with a goal in the 90th minute but failed to capitalize on a chance in the final seconds, giving gold to Mexico. Korea took the bronze.
A gold for Russia came in the men's 50-kilometer race walk, which set off on The Mall by Buckingham Palace on Saturday morning.
Just over three-and-a-half hours later, Sergey Kirdyapkin crossed the line first to take gold, ahead of Australian Jared Tallent, who took silver in Beijing, and China's Tianfeng Si.
The field was without Beijing gold-medalist Alex Schwazer, who was expelled from the Games on Friday after testing positive for a banned substance, recombinant erythropoietin (rhEPO), which aids red blood cell production. The 27-year-old Italian had set an Olympic record four years ago, but it was beaten by Kirdyapkin on Saturday.
Another athlete, Syrian hurdler Ghfran Almouhamad, was disqualified from the Games on Saturday, the International Olympic Committee said.
Almouhamad, who went out in the heats of the women's 400-meter hurdles, tested positive for the banned substance methylhexaneamine, a stimulant.
Over at the Aquatics Center, Team USA celebrated by jumping into the pool after David Boudia won the gold in the 10-meter platform. China's 19-year-old Qiu Bo, who had entered the final as the favorite, appeared disappointed with his silver while Britain's Tom Daley jumped for joy to win a bronze in front of a home crowd.
Team GB's first gold medal of the day came on the sparkling waters of Eton Dorney Lake, when Ed McKeever won the men's K1 200-meter canoe sprint.
The gold was the 26th for the host nation, which is in third in the medal table, behind the United States and China and ahead of Russia.
Ukraine picked up gold in the men's C1 200-meter canoe sprint, thanks to the paddle power of Yuri Cheban, and silver in the women's canoe spring kayak single K1 200-meter. Lisa Carrington of New Zealand took gold in that event.
Russia's pair stormed through the field to claim victory in the men's K2 200-meter race, the last canoe sprint event and final contest at Eton Dorney, with silver going to Belarus and bronze to Great Britain.
Meanwhile, defending champion Evgeniya Kanaeva claimed gold for Russia in individual all-around rhythmic gymnastics, the final individual gymnastics contest of the Games.
Fellow Russian Daria Dmitrieva took silver and Liubou Charkashyna of Belarus took bronze.
Once the athletics competitions wrap up in the stadium Saturday night, the race will be on for technical crews to transform it for the closing ceremony.
London Games organizers say musical performances will be the focus of the closing ceremony, titled "A Symphony of British Music."
Among the British acts rumored to be taking part are the Spice Girls and the Pet Shop Boys, as well as singers Jessie J. and George Michael and rapper Tinie Tempah.
And like the spectacular opening ceremony just over two weeks ago, which was characterized by a quirky exuberance, the closing will feature thousands of local volunteers and schoolchildren.
The show, attended by many of the 10,500 athletes who competed at the Games, will likely be watched on television by around 750 million people worldwide, the London organizing committee says.
A CNN/ORC poll released Saturday showed that two-thirds of Americans think the London Games have been very successful. Nearly a quarter said they enjoyed watching the Games more than on previous occasions.