Gauff advanced to a meeting with another Spaniard, Cristina Bucsa, after powering past Badosa 6-4, 7-6(5) in just under two hours.
The 22-year-old American star, who is chasing a repeat of her 2023 US Open victory, had lost five of her eight previous meetings with Badosa.
But Gauff never looked like letting their latest encounter slip with a largely confident performance to open the Arthur Ashe Stadium evening session.
"Obviously, you know, I would prefer maybe not to play somebody I've lost to so many times second round. But I think today was a big confidence booster.
"And I think getting through in straight sets too makes a big difference. Yes, I was battle-tested, but I think it was a good battle where I wasn't out on the court for three hours."

After a steady start, the American broke Badosa in the seventh game of the opening set when the 28-year-old Manhattan-born Spaniard fluffed a risky drop shot into the net.
Gauff held serve to love to go 5-3 up before comfortably clinching the set with another rock-solid service game.
Gauff looked to be ready to take control early in the second set, when Badosa was broken in the third game - again attempting a delicate drop volley which fell short.
Badosa though broke back to knot the set at 4-4 and then held off two break points to move into a 5-4 lead.
After Gauff levelled to make it 5-5, the two women swapped breaks of serve to set up the tiebreak, with Gauff sealing victory when Badosa smacked a backhand long.
Gauff, whose game was in disarray this time last year, said she feels more at ease now in pressure moments of a match.
"I definitely feel more comfortable, especially on the serving end of things," she said.
"I mean, she broke me two times, one time serving for it. I wasn't too upset. I was, like, I don't think I could have served that much better.
"So I think that's the part of my game where I feel less pressure and I know I can get a big serve in when I need to. It's just about if my opponent responds, and she did."
