German sixth seed Alexander Zverev was taken to a deciding set for a second successive match as he saw off American Frances Tiafoe 6-3 3-6 6-2 2-6 6-3 in the US Open second round.
Zverev hit 52 unforced errors as the momentum swung throughout.
Second seed Rafael Nadal had a walkover with Australian Thanasi Kokkinakis withdrawing with a right shoulder injury.
The three-time champion will now play Fernando Verdasco or Hyeon Chung.
Australian Nick Kyrgios produced a stunning display of serving as he hit 24 aces in his routine 6-4 6-2 6-4 win over unseeded Frenchman Antoine Hoang.
Kyrgios, the 28th seed, has now reached the third round four times but has never made it past that phase. He now takes on unseeded Russian Andrey Rublev, who got through as a result of the retirement of Frenchman Gilles Simon after the first set of their match.
Meanwhile, Zverev will play Slovenian Aljaz Bedene, who beat 29th seed Benoit Paire, in the third round.
The 22-year-old, who defeated Radu Albot in the first round, said: "Frances gave me an unbelievable fight today. I'm just happy to get the win somehow."
Elsewhere, in-form Cincinnati Masters champion Daniil Medvedev recorded his 16th win from the past 18 matches with a 6-3 7-5 5-7 6-3 win over Hugo Dellien of Bolivia. The Russian fifth seed will now play Spain's Feliciano Lopez.
American Denis Kudla's reward for defeating 29th seed Dusan Lajovic 7-5 7-5 0-6 6-3 is a third-round contest against defending champion and world number one Novak Djokovic.
Swiss 2016 champion Stan Wawrinka, 34, saw off fellow veteran Jeremy Chardy of France 6-4 6-3 6-7 (3-7) 6-3. The 23rd seed will now play Italy's Paolo Lorenzi.
Belgian 15th seed David Goffin, beaten by Medvedev in the recent final at Cincinnati, defeated Gregoire Barrere 6-2 6-2 6-2 and will play Spain's Pablo Carreno Busta in the third round.
American 14th seed John Isner, a quarter-finalist last year, will play either 2014 champion Marin Cilic or German Cedrik-Marcel Stebe after he secured a 6-3 7-6 (7-4) 7-6 (7-5) victory over Jan-Lennard Struff of Germany.
And Australian Alex de Minaur, 20, overcame Chile's 31st seed Cristian Garin 6-3 7-5 6-3 to set up a tie against seventh seed Kei Nishikori.