Swiatek grabbed the opening set against Ostapenko but the unpredictable Latvian stormed back to win 3-6, 6-3, 6-1 and secure her fourth victory in as many meetings with the Polish star.
The mercurial Ostapenko, who had never made it to the last 16 in New York before this week, goes on to face title contender and home favourite Coco Gauff in the last eight after blasting Swiatek out of the tournament.
Undeterred by falling behind, Ostapenko's typically fearless and aggressive approach rendered Swiatek helpless and ensures there will be a new world number one after the US Open.
Change at the top
Swiatek's 75-week reign will come to and, with rival Aryna Sabalenka set to take over top spot.
"I always expect a tough battle against Iga, she's such a great player and won many Slams and is so consistent," said Ostapenko, the 20th seed and 2017 French Open champion.
"I knew I had to be aggressive and play my game because that's what she doesn't like.
"I was just thinking that I have to play until the very last point, until we shake hands. I felt like I was playing better and didn't give her many chances.”
Gauff ended Caroline Wozniacki's fairytale Grand Slam comeback earlier Sunday as the sixth seed saw off the former world number one 6-3, 3-6, 6-1.
The 19-year-old registered her 15th win in 16 matches, a run including titles in Washington and Cincinnati last month.
Gauff sparked into life after dropping the opening two games to pocket the opening set, but Wozniacki -- playing her first Grand Slam in over three years -- wound back the clock to level the match.
Two-time US Open runner-up Wozniacki broke to start the deciding set, triggering a ferocious response from Gauff who swept the final six games to close out a gutsy victory.
"Caroline is back, it's like she's never left," Gauff said of the 33-year-old Wozniacki, appearing in just her third tournament since returning to the sport last month.
"The level she played today was amazing, and she's been an inspiration for me growing up.”
Wozniacki, who made her tour debut when Gauff was only one, retired after the 2020 Australian Open to start a family, giving birth to two children.
She was trying to emulate Kim Clijsters, who beat the Dane in the 2009 US Open final on her own return to Grand Slam tennis from maternity leave.
Djokovic sails as Americans progress
Djokovic swept into his 13th US Open quarter-final, cruising past 105th-ranked Croatian qualifier Borna Gojo 6-2, 7-5, 6-4 to advance to a showdown with American No.1 Taylor Fritz.
After recovering from two sets down in the previous round, Djokovic dictated from the outset against 25-year-old outsider Gojo who had won just one Grand Slam match prior to this week.
Djokovic broke twice in the first set, the 23-time Grand Slam winner shaking off an early wobble in the second and procuring another break in the third to polish off Gojo without the drama of his preceding five-set victory over Laslo Djere.
The 36-year-old Serbian star will on Tuesday look to continue his dominance of Fritz, a player he's beaten in all seven past meetings including a one-sided affair in Cincinnati last month.
"He's been playing some terrific tennis particularly on home soil here in the States," Djokovic said of Fritz.
"Obviously the matches are going to get tougher from here onwards and I'm ready. It's going to be great.”
Djokovic and Fritz on collision course
Fritz became the third American man to reach the quarter-finals Sunday after a straight-sets win over Swiss qualifier Dominic Stricker.
The ninth seed knocked out world number 128 Stricker 7-6 (7/2), 6-4, 6-4 to match his mother Kathy May's run to the 1978 US Open quarter-finals.
He joins compatriots Frances Tiafoe and Ben Shelton in the next round. It is the first time the US has had three men's quarter-finalists in New York since 2005.
Tiafoe, seeded 10th, advanced to an all-American quarter-final against 47th-ranked Shelton after defeating Australia's Rinky Hijikata 6-4, 6-1, 6-4.
The 25-year-old Tiafoe reached the semi-finals of the US Open last year where he lost in five sets to eventual champion Carlos Alcaraz.
Meanwhile Shelton, 20, took down 14th-seeded compatriot Tommy Paul in four sets to reach his second Grand Slam quarter-final of the year.
He avenged his loss to Paul in the last eight of the Australian Open, winning 6-4, 6-3, 4-6, 6-4 to become the youngest American man to reach the US Open quarters since Andy Roddick in 2002.