24-year-old Ledecky touched in 8min 12.57sec to outpace Australian arch-rival Ariarne Titmus, who clocked a personal best 8:13.83 to earn silver ahead of Italy's Simona Quadarella (8:18.35).
Katie Ledecky warned her rivals she could still be racing in 2028 after the American stormed to her third straight Olympic 800m freestyle gold on Saturday and banked her fourth Tokyo medal.
The 24-year-old touched in 8min 12.57sec to outpace Australian arch-rival Ariarne Titmus, who clocked a personal best 8:13.83 to earn silver ahead of Italy's Simona Quadarella (8:18.35).
Ledecky now has 10 Olympic medals -- seven golds and three silvers. She was incredulous when asked if it might have been her last race.
"That was not my last swim," Ledecky said. "I'm at least going to 2024, maybe 2028, we'll see. I knew it would be my last swim here. You never take anything for granted, you just try to take it all in."
Ledecky is only the third woman to win the same event at three consecutive Olympics.
"It's awesome. I wanted to finish on a really good note," said Ledecky, who was bent over with exhaustion. "I'm so happy and I'm in a lot pain too."
Titmus has dethroned Ledecky in both the 200m and 400m freestyle in Tokyo but her US rival is the undisputed queen of the longer distances, having already won the inaugural 1500m gold.
She has imposed her will on the rest of the world over 800m since 2012, winning the event at the London and Rio Olympics along with four straight world championship titles.
Ledecky's young team-mate Katie Grimes, just 15, was fourth, signalling she has a big future ahead. The pair hugged at the end of the race.
"She's awesome," said Grimes. "She's a perfect teammate. To be able to swim next to her in that final was incredible."
Ledecky flew out of the blocks and was leading at the first 50m, never relinquishing the lead despite a gallant effort by Titmus to reel her in.
She leaves Tokyo after winning gold over 800m and 1500m and taking silver behind Titmus in the 400m. She was also part of the US 4x200m relay team that was second to world record-breaking China.