Swiatek trailed by a set and a break but fought back to win 2-6 6-4 6-1 against the German.
The 21-year-old from Poland has been the standout WTA player this season and is bidding for a seventh title in 2022.
The reigning French Open champion will play American Jessica Pegula, who beat Czech 21st seed Petra Kvitova.
Later on Monday, Czech 22nd seed Karolina Pliskova overcame three-time finalist Victoria Azarenka in three sets to reach the last eight.
Pliskova, a finalist in 2016, reached the quarter-finals at the US Open for the second successive year with a 7-5 6-7 (5-7) 6-2 win over the Belarusian.
She will meet Belarusian sixth seed Aryna Sabalenka, who came from a set down to beat American 19th seed Danielle Collins 3-6 6-3 6-2.
Swiatek took over as the world number one following Ashleigh Barty’s shock retirement in March, fully justifying the position by going on a 37-match winning streak.
The dominance led to six titles in a row, winning in Doha, Indian Wells, Miami, Stuttgart and Rome before adding the second triumph of her career at Roland Garros.
Unsurprisingly, she has been unable to sustain that sky-high level since but had not dropped a set in New York until 23-year-old Niemeier took the lead.
Swiatek made a lot of errors in the first set and start of the second, enabling Wimbledon quarter-finalist Niemeier to threaten a major upset and continue her breakthrough season with a notable win.
But the German began making mistakes at crucial times – particularly with double faults – and Swiatek slowly improved to better last year’s run to the fourth round at Flushing Meadows.
“I’m proud I just didn’t lose hope,” said Swiatek.
“She was playing really good in the first set and the second set I tried to focus on the small things that are the base for us. I’m pleased I kept my level.”
Home hope shakes off nerves in blistering win
Eighth seed Pegula, 28, reached the quarter-finals of her home major for the first time – and the first time she had beaten a seeded player there – with a clinical performance on Arthur Ashe Stadium.
Two-time Wimbledon winner Kvitova, 32, led 2-0 in the second set but Pegula, leaning on home support, won the next six games to reach a fourth Grand Slam quarter-final.
“I thought I handled my nerves really well,” said Pegula, who also reached the last eight in Melbourne and Paris this season.
“I told myself not to get frustrated. She returns really well and it’s difficult if you’re not getting in first serves. I just really wanted to stay committed to hitting my spots.”
Pegula is the daughter of Terry Pegula, an oil and gas magnate who, according to Forbes, is worth $6.7bn (£5.82bn).
In 2014 her family bought the Buffalo Bills who kickstart the NFL season against Super Bowl champions Los Angeles Rams on Thursday (01:20 BST Friday).
The US Open women’s semi-finals are due to start at 00:00.
“Hopefully it’s not at the same time [as a potential semi-final],” joked Pegula, who lost to Swiatek in the French Open quarter-finals. “But if I’m still here playing I don’t mind missing the game.”