Michael Phelps is the most decorated Olympian in history, so it was only fitting that the he finished the final race of a long Olympic career with a gold-medal performance.
Phelps, 27, swam the butterfly leg of the men's 4x100-meter relay, closing the gap between the United States and leader Japan. Nathan Adrian brought the victory home in the anchor leg of the race.
Japan took the silver medal in the relay, while Australia claimed the bronze.
Phelps, who won his first Olympic gold in Athens in 2004, left the pool in London one final time, sharing a group hug with his teammates.
And soon, he'll be stepping onto the medal podium for the last time. The swimmer has said he will not race in the 2016 games in Rio de Janeiro.
Phelps has 18 career Olympic gold medals, two silver and two bronze, making him the most decorated Olympian in history with 22 medals.
He won gold Friday in his last individual race, beating his teammate Ryan Lochte in the 200-meter individual medley.
U.S. swimmers dominated in London, winning a total of 30 medals.
Shortly before Phelps' final swim, Olympic darling Missy Franklin and Team USA won gold in the women's 4x100-meter relay.