The quartet of Allison Schmitt, Leah Smith, Maya Dirado and Ledecky won in a time of seven minutes 43.03 seconds, with Australia second and Canada third.
America trailed Australia but Ledecky, the 200m and 400m freestyle champion, overtook Tamsin Cook on the last leg.
Find out how to get into swimming with our special guide.
Ledecky, 19, has now won four Olympic gold medals during her career.
Her first Olympic gold came when she won the 800m title as a 15-year-old at London 2012.
Ledecky will attempt to complete the sweep when she goes in the 800m heats on Thursday, with the final taking place on Friday.
Subscribe to the BBC Sport newsletter to get our pick of news, features and video sent to your inbox.

Allardyce took charge of the Black Cats in October when they were winless in their opening eight matches, but guided them to 17th and safety.
"I don't want to go through that again," he told BBC Newcastle.
Allardyce added that he plans to discuss transfer targets with owner Ellis Short in the next few days.
Sunderland survived with a game to spare after victory over Everton with Allardyce describing it as a "miraculous achievement."
However the former West Ham and Bolton boss, who has never been relegated, says the club must learn from its mistakes this campaign.
"Our season has been a difficult one. I don't want to go through that again - that's the most important thing for me, not to put myself through what I did to get where we are today," he added.
"The turnaround has given me great satisfaction. It hasn't made me forget about when it was tough, and we have to make sure it doesn't happen again."
Sunderland ended the season with only one defeat in 11 games, and were unbeaten in their last six.
Allardyce plans to discuss summer signings with Short when he is back from a mini-break - a meeting that "will be one of great importance" according to the the 61-year-old.
"We will have a couple of days off and then see what the situation is," Allardyce said.
"I can't look or see in to the future. It looks very positive but until we need to get down and talk about it. Then we can move forward."

The third death was announced on Monday and five are critically ill in hospital, following the event in Haaksbergen in Overijssel province.
Video footage shows the modified pick-up with outsized tyres driving over a row of cars as part of the show, but then veering off course.
A boy, a man and a woman died.
Besides the five critically injured there are another 18 with lesser injuries, the Haaksbergen mayor's office said.
Helicopters helped ferry the injured to hospitals in three nearby towns.
"A so-called monster truck drove into a crowd of spectators. A terrible accident with two dead victims," town authorities said on their website on Sunday.
Video of the accident posted on social media showed the truck revving hard and then riding over six cars before suddenly heading towards spectators who were separated from the show by metal barriers.
Screaming, some managed to get away but others had no time to escape.
The driver of the truck has been detained and an inquiry has been opened, police said, quoted by local media.
Katie Ledecky won her third gold of the Rio Games as she guided the United States to victory in the women's 4x200m freestyle relay final.
[NEXT_CONCEPT]
Sunderland manager Sam Allardyce says he is determined to make sure the club is not involved in another Premier League relegation fight next season.
[NEXT_CONCEPT]
Three people were killed when a "monster truck" ploughed into a crowd of onlookers at an annual motor show in the east of the Netherlands.