France overhauled the United States at the death to claim the 4x100 metres freestyle relay title in London.
The United States had led from the start and appeared to be on course for gold but Yannick Agnel inched ahead of Ryan Lochte in the final 10 metres to claim the title in three minutes 09.83 seconds.
It meant Michael Phelps won his first medal of the 2012 Olympics and his 17th overall but it was the French who were celebrating as they exorcised the memory of 2008 when they lost out on the touch to the Americans.
Earlier at the Aquatic Centre, South Africa's Cameron van der Burgh was crowned Olympic champion after claiming the 100 metres breaststroke title in a new world record of 58.46 seconds.
The 24-year-old had qualified fastest for the final with the best time in the world in 2012 and an Olympic record.
He led from start to finish to take 0.12secs off Brenton Rickard's 2009 record. Christian Sprenger was second and Brendan Hansen third
Notable by his absence, though, was Alexander Dale Oen, the Norwegian world champion who died in April.