Ostapenko dumps champion Swiatek out of US Open
The Polish three-times Grand Slam winner had not dropped a set before Sunday's match but was unable to hold off the confident 20th seed’s charge.
Ostapenko fired off a crisp forehand winner to break her opponent's serve on match point, pumping her fist as she extended her career head-to-head record against Swiatek to 4-0.
The 2017 Roland Garros champion next faces American sixth seed Coco Gauff, who beat wildcard Caroline Wozniacki in three sets earlier in the day.
"I always expect a tough battle against Iga," Ostapenko said. "I knew I had to play my game. I have to be aggressive because that's what she doesn't really like and I was just fighting until the very last point."
Swiatek got off on the wrong foot, helping Ostapenko to a break in the first game with a double fault and a pair of forehand errors.
She broke back immediately, though, and converted on another break-point chance with a fine forehand winner in the sixth game before taking the first set.
But things began to fall apart for Swiatek in the second set.
She sent a forehand out to hand Ostapenko a break in the second game and was unable to convert a break point in the ninth game before Ostapenko tied the match at 1-1.
Swiatek looked demoralised in the third set while Ostapenko upped her level further, taking full control to cruise through the first five games and adding only two more unforced errors to her count en route to sealing victory.
She faces a tough challenge against an in-form Gauff, whom she beat in the fourth round of the Australian Open earlier this year.
"She's a great young player, I played against her this year in Australia. It was a tough match," said Ostapenko.
"Of course, it's going to be another tough match. I don't expect any easy matches here at the Grand Slams. So I'm ready for another battle."