(CNN) -- Michael Phelps repeated his record breaking feat of winning three straight Olympic gold medals in the same event with a gutsy victory in the men's 100m butterfly Friday.
It was the 17th gold medal of his remarkable career, the 21st overall, and his final swim in an individual race before retiring after the London Games.
Phelps had won the 200m Individual Medley Thursday night to create Games history for a male swimmer for successive Olympic victories and was not to be denied in the sprint butterfly.
The American superstar was only seventh at the turn but powered past the field to win in 51.21 seconds.
South African Chad le Clos, who had pipped him to gold in the 200m butterfly, and Russian Evgeny Korotyshkin shared silver, both clocking 51.44.
"I am just happy that the last one was a win. It's very special," Phelps told BBC Sport.
He will round off his efforts in the medley relay final Saturday where the U.S. are favored to win.
It was to prove another superb night for Phelps' teammates with 15-year-old Katie Ledecky upsetting home favorite and defending champion Rebecca Adlington in the 800m freestyle final.
Ledecky led from the first length at the London Aquatics Centre to come within half a second of breaking Adlington's world record set in her 2008 Beijing triumph.
She touched in eight minutes 14.63 seconds ahead of Mireia Belmonte Garcia of Spain in silver with Adlington in bronze. Britain's main hope for a swimming gold also took bronze in the 400m free.
Ledecky said she received a good luck message from Phelps before the final.
"Michael is the first Olympian I ever met before I started swimming at the U.S. Nationals in 2002 or 2003 in Maryland, so to get a good luck before the race really calmed me down and I was ready to swim my race," she said.
Adlington tried to swallow her disappointment with a defiant message. "Everyone expected me to get a gold medal. I am so proud. I have been in four Olympic finals and got four medals, so that's nothing to be ashamed of, but I was disappointed with the time," she told BBC.
The third gold of the penultimate night of finals for the U.S. came from teenage sensation Missy Franklin in the women's 200m backstroke.
It was the 17-year-old's third gold of the Games and she did it in style with a world record of two minutes 4.06 seconds to have clear water between herself and second placed Anastasia Zueva of Russia.
Franklin's teammate Elizabeth Beisel took the bronze.
"It feels absolutely amazing, I can't think of a better way to end my individual events," Franklin said.
Frenchman Florent Manaudou prevented a U.S. clean sweep of gold with a shock win in the men's 50m freestyle.
Manaudou, 21, the younger brother of former Olympic women's 400m freestyle champion Laure, hit the took victory in 21.34 seconds.
Cullen Jones of the United States took the silver with Brazilian world record holder Cesar Cielo in the bronze medal position.