The 22-year-old defeated Badosa 6-4, 7-6 (7/5) in under two hours after having lost five of her last eight encounters against the number 87 ranked opponent.
The match began with a steady start from both women before Gauff broke Badosa in the seventh game of the first set, going on to hold serve to go 5-3 up prior to clinching the set.
The American had a dominant start to the second set before Badosa fought back to level the set at 4-4 and subsequently holding off two break points to gain a 5-4 lead.
However, Gauff got back level at 5-5 with the set going into the tie break where she managed to complete the victory after Badosa smacked a backhand long during a match-point.
"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," said the world number four ranked star after the match.
"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."
The one-time US Open champion will face Spain's Cristina Bucsa in the next round.
READ MORE: Iga Swiatek cruises into US Open third round