Cannot play media. Sorry, this media is not available in your territory.
Video - Phelps seals second gold in relay
Michael Phelps remains on track for a record eight Olympic titles as the American 4x100m freestyle swimming team rallied to notch a thrilling victory.
The US broke the world record with a time of 3:08.24, beating France into silver, while Australia took bronze.
The 23-year-old Phelps maintained his own excellent form, but the team had to rally after trailing at the midway point in a tight relay.
Jason Lezak beat Alain Bernard to the wall to spark wild celebrations.
Phelps' dream of breaking Mark Spitz's record of seven golds in a single Games appeared to be doomed when the French took over the lead.
"Lezak, the oldest American male swimmer at 32, pulled back over the closing strokes and outstretched Bernard by a fingertip.
Phelps celebrated wildly as he stayed on track for eight golds
"I was going nuts," Phelps, who swam the leadoff leg and then cheered his team-mates on, said.
"As soon as (Lezak) came off that last wall, I started going crazy.
"We're a team. We went in as a team and now we're exiting as a team - and we're going out with that gold that we needed to get back."
The Americans had lost the 4x100m freestyle relay to Australia and South Africa at the last two games, having previously won it seven straight times.
Earlier on Monday, Phelps came third in the semi-final of the men's 200m freestyle.
He can now focus on single-handedly winning a third gold in that event after the closest of shaves at the second hurdle.