The world number one and French Open champion is the only player left in either of the singles draws who has previously lifted a slam trophy and she raised her level in a 6-3 7-6 (4) victory over American Pegula.
Both players struggled to hold serve and Swiatek was twice broken serving for the match but she came through the tie-break to set up a clash with Aryna Sabalenka on Thursday.
Swiatek has not been at her best since her 37-match winning run came to an end at Wimbledon, and she said: "I feel like it just clicked. I was able today to use my intuition a little bit more.
"I didn't force myself to do every step right, all this technical stuff that I've been working on. It was more natural today. That was nice because I didn't have thousands of things to improve in my head."
Eighth seed Pegula has been a rare consistent performer in the top 10 this season and this was her third major quarter-final of the year but she is yet to go further.
She made the first move in the opening set with a break for 3-2 but let Swiatek back in from 30-0 in the next game and the Pole was ruthless, dropping just two more points in the set.
The second set was a story of constant swings in momentum, with Swiatek, who was unhappy to be given a time violation in the fifth game, breaking serve five times only to be pegged back each time.
Pegula was given a warning for smacking a ball into the stands in frustration after another break for 4-3, while Swiatek had the most fortunate of net cords to move 5-4 ahead.
The pair were dragging each other all around the vast expanses of Arthur Ashe in lengthy rallies but it was Swiatek who was more often on the front foot and she finally made it across the finish line.
The 21-year-old has been enjoying playing with slightly lower expectations for herself, saying: "Looking logically at the last tournaments, I just didn't know if this one is going to be possible for me to be consistent and to win so many matches in a row.
"But I feel like I've been playing better and better every week since the start of this swing. It gave me actually a lot because I could be kind of an underdog again, not maybe fully, but just not expect from myself that I'm going to win everything right now."
Pegula was frustrated to come up just short again at a slam, saying: "I go back and forth. Oh, I should be positive. At the same time I'm like, 'F***, three quarter-finals'. Sorry, but it sucks. It sucks.
"I wish I could have done it here at my home slam, but I guess not. I wish I didn't have to play Iga every quarter-final or Ash Barty, which seem to be the two people that don't really lose that often. So it just sucks."