Reigning Wimbledon champion Simona Halep, meanwhile, crashed out early in New York for a third year running, blowing a match point in a tense three-set loss to 116th-ranked Taylor Townsend.
Gauff, who made a remarkable run to the fourth round at Wimbledon before falling to Halep, defeated Hungarian qualifier Timea Babos 6-2, 4-6, 6-4 to become the youngest player in the last 32 at a US Open since Anna Kournikova in 1996.
Three-time US Open champion Nadal advanced without striking a ball when injury-plagued Australian Thanasi Kokkinakis pulled out of their scheduled evening tie on Arthur Ashe with a right shoulder problem.
The Spanish 18-time Grand Slam winner will meet South Korean qualifier Chung Hyeon for a spot in the last 16.
His path to a fourth title, already helped with “Big Three” rivals Novak Djokovic and Roger Federer on the opposite side of the draw, cleared further having already seen four top-10 rivals dumped out in the first round.
Alexander Zverev, the sixth seed, is the highest-ranked player remaining on his side of the draw, as the German survived a second successive five-set marathon by outlasting American Frances Tiafoe 6-3, 3-6, 6-2, 2-6, 6-3 to equal his best US Open run.
Townsend upended women’s fourth seed Halep 2-6, 6-3, 7-6 (7/4), the Romanian consigned to another premature exit at Flushing Meadows, having been knocked out in the opening round in 2017 and 2018.
Top seed Osaka proved too strong for 53rd-ranked Magda Linette of Poland, sweeping to a 6-2, 6-4 victory.
Among the celebrities watching her match at Louis Armstrong Stadium were basketball legend Kobe Bryant and former NFL quarterback Colin Kaepernick, whose kneeling protest became a national symbol for champions of social justice and racial equality.
Men’s fifth seed Daniil Medvedev, coming off a maiden Masters title in Cincinnati, was struck down by cramp during a 6-3, 7-5, 5-7, 6-3 win over Bolivia’s Hugo Dellien.
Stan Wawrinka, the 2016 US Open champion, beat Jeremy Chardy in four sets and is on a fourth-round collision course with Djokovic, while Australian 28th seed Nick Kyrgios rolled past 104th-ranked French wildcard Antoine Hoang 6-4, 6-2, 6-4.
Andrea Petkovic knocked out Czech sixth seed Petra Kvitova 6-4, 6-4, while 15th seed Bianca Andreescu and two-time runner-up Caroline Wozniacki also progressed. (AFP)