The defeat means that the 22-year-old Pole will lose her world No. 1 spot to Belarusian Aryna Sabalenka after the US Open.
Świątek, who was the defending champion at Flushing Meadows, was stunned 6-3, 3-6, 1-6 in the last 16 by the 20th-seeded Latvian.
Ostapenko maintained her clean sheet against Świątek. She is now 4-0 in her career against the Pole.
Świątek, coached by countryman Tomasz Wiktorowski, topped the world rankings in women's tennis for 75 consecutive weeks, after taking over from Australian Ash Barty on April 4, 2022.
The 2023 US Open runs until September 10.
(gs)
Source: PAP, wtatennis.com