Swiatek dropped her first set of the tournament before securing a 6-4 6-7 (3-7) 6-3 win over the 16th seed in two hours 25 minutes. She will face the 27th-seeded Petra Martic, who advanced past 11th seed Barbora Krejcikova 6-3 7-6 (7-1).
Poland's Swiatek is the first player to reach the quarters or better at eight consecutive clay-court tournaments since Simona Halep made it to 10 in a row between 2016 and 2019.
Third-seeded American Jessica Pegula, last year's runner-up in Madrid, reached the last eight by beating Martina Trevisan 6-3 2-6 6-3.
Earlier, Russian teenager Mirra Andreeva's impressive run came to an end with a loss to second-seeded Aryna Sabalenka.
After three straight-set victories against top-40 opponents in her main-draw debut, the 16-year-old wildcard couldn't get past Sabalenka in the fourth round, losing 6-3 6-1 her debut centre-court appearance in the Spanish capital.
Andreeva became the youngest player to reach the last 16 of a WTA 1000 event after upsetting 2021 US Open finalist Leylah Fernandez in the first round, 14th-ranked Beatriz Haddad Maia in the second and 19th-ranked Magda Linette in the third. She had won 16 straight matches at all levels before falling to Sabalenka, her first top-10 opponent.
"It was a great match. I'm really happy with the result," Sabalenka said.
"In the first few games I was just trying to adjust to her game and her rhythm. After that I started feeling my game a little bit better and started playing better."
Defending champion Sabalenka has reached at least the quarter-finals in all seven tournaments she has played in 2023 with a 26-4 record, winning the Australian Open.
Her next opponent will be Mayar Sherif, who defeated 24th-seeded Elise Merten 6-4 0-6 6-4 after nearly three hours to become the first Egyptian to reach the last eight of a WTA 1000 tournament. She was already the first Egyptian woman to play in a grand slam, and the first to win a tour title.
"It means a lot, just mentally, to be able to know that I can do this, that I can compete at the highest level in tennis," said the 59th-ranked Sherif, who lives and trains in Spain.
"It gives me a lot of motivation to keep improving, to keep working on the things that I need to work on, and to obviously take that confidence for the rest of the year."
Maria Sakkari progressed with a 6-4 6-4 defeat of Paula Badosa, ending Spanish interest in the women's tournament.
The Greek ninth-seed will meet Irina-Carnelia Begu who upset 14th-seeded Liudmila Samsonova 6-4 6-4.