(CNN) — In the end, it was Michael Phelps’s day.
On Tuesday he became the greatest Olympian ever, setting a record with his 19th medal after anchoring the U.S. men’s 4×200-meter freestyle team to gold.
The crowd at London’s Aquatic Centre rose to its feet as Phelps churned home, well ahead of France’s Yannick Agnel.
With the gold, Phelps broke a brief tie with Larisa Latynina, a Soviet gymnast who won 18 total medals from 1956 to 1964.
Phelps now has 15 gold, two silver and two bronze medals spanning four Olympics.
An hour earlier, Phelps was a dejected silver medalist.
Phelps led his signature race, the 200-meter butterfly. from the start until the last few meters, appearing to be ready to become the first man to win an individual event in three consecutive Olympics.
But just as Phelps glided into the finish, South African Chad le Clos, a 20-year-old whose idol was swimming in the lane right next to him, cranked one last big stroke to edge his hero Phelps at the wall.
It reminded swimming commentators of Phelps’ 100-meter butterfly win at the Beijing Games when he took a quick final stroke as Serbian Milorad Cavic stretched for the wall. This time it was Phelps who was caught reaching.
After the race, the shocked Phelps put his face in his hands. it was only later, on the medal stand when he broke into a big smile.
After the relay the smile grew even bigger.
In gymnastics, the “Fab Five” United States squad lived up to its billing, routing the field for the women’s team title. Gabby Douglas led the U.S. to a 183.596 score, while Russia finished second with 178.503. Jordyn Wieber was a key part of the victory also, placing third in the vault and fourth on the floor.
“I’m so proud of these girls. We did awesome,” Douglas said. “A lot of hard work and sacrifice in the gym, and it all pays off.”
Wieber, who didn’t qualify for the individual all-around competition because Olympic rules limit the entrants to two per team, said it was a team win.
“This couldn’t be possible without everyone stepping up today,” she said.” Everyone did their job and was completely amazing. I am so excited.”
History had already been made once at the Olympics on Tuesday when Queen Elizabeth’s equestrian granddaughter Zara Phillips put her name in the record books earlier in the day by becoming the first member of the British royal family to win an Olympic medal. She claimed a silver as part of the British eventing team. Her mother, Princess Anne, a 1976 Olympic equestrian, draped the medal around her neck.
Another British Olympian, Tom Daley, was in the news for a less happy reason as police arrested a 17-year-old accused of abusing the teen diver in comments on Twitter.