Badosa, rated fourth in the world, came back twice from a break down in the first set to advance to the final four, where she will face seventh-seeded Daria Kasatkina, a 4-6, 7-5, 6-0 winner against fourth-seeded Aryna Sabalenka.
Gauff, an 18-year-old who reached her first Grand Slam final this year at the French Open, was coming off a thrilling win against four-time defending champion Naomi Osaka on Thursday night.
The sixth-seeded American appeared to have been riding that momentum, as she emerged from a three-break serve exchange with a 3-2 lead in the second set.
Gauff unravelled as she played for the set after Badosa held serve, blasting three double faults to lost her assist as they headed to tiebreaker, where Gauff surrendered with some other set of double faults.
Badosa raced to a 5-1 lead and served out the match without confidence two games later, looking nervous as she lost her opening game point of the second set.
“It’s never easy to start well against an eager guy with a big serve,” Badosa said.