Michael Phelps' final individual Olympic race ended in silver, when he was beaten into second place in the 100-metre butterfly by Joseph Schooling.
The pair met eight years ago when Phelps was already an Olympic legend and Schooling a teenaged super-fan at school in Singapore.
Schooling built a big lead on the opening lap and easily held off the hard-charging Phelps, who tied for silver with Laszlo Cseh of Hungary and Chad le Clos of South Africa.
Phelps has a chance to win his 23rd gold in his final race of the Olympics, the 4x100-metre medley relay.
His countrywoman Katie Ledecky delivered another dominating performance, however, breaking the world record in the 800-metre freestyle.
Ledecky joined Debbie Meyer as the only women to sweep the three longer freestyle events at the same Olympics.
Meyer took the 200, 400 and 800 at the 1968 Mexico Games, and Ledecky matched that performance with a couple of world records as well.
Ledecky was merely racing the clock as she powered away from the field to touch in 8 minutes, 4.79 seconds, eclipsing the mark 8:06.68 that she set in January.
Fellow US swimmer Maya DiRado denied Hungarian Katinka Hosszu's bid to become a four-time gold medalist. Hosszu, known as the Iron Lady, got off to a blistering start and led almost the entire race.
But DiRado rallied furiously on the final lap and got Hosszu at the touch to win in 2 minutes, 5.99 seconds.