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.
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.