Halep overcame injury and 30-degree heat to set-up a last-eight clash against two-time runner-up Azarenka.
Halep needed 2hr 38 min, as well as a 10-minute heat break, to down German 24th seed Sabine Lisicki 6-7 (6/8), 7-5, 6-2 on Monday.
Halep, 23, is the first Romanian in the last eight in New York since Irina Spirlea went to the 1997 semi-finals.
But she did it the hard way, letting two set points slip away in the first set before then requiring a medical timeout to have her left thigh tightly strapped.
Also Read
"It's unbelievable to reach my first quarter-final at the US Open. It was a crazy match," said Halep after her fourth successive win over the 2013 Wimbledon runner-up.
"I'm pretty tired but I would have been very unhappy with myself had I lost."
Despite the injury, Halep insisted it was Lisicki who was the keener of the two to take advantage of the heat rule, which allows women players to leave the court for 10 minutes after the second set if the temperature goes beyond 30.1 degrees.
Azarenka reached her fourth quarter-final in four years with a 6-3, 6-4 win over Varvara Lepchenko of the United States.
The former world number one, whose season has been stalled by a left thigh strain, appeared on Arthur Ashe Stadium with both biceps tightly strapped.
"It's a little embarrassing. I have blisters from my shirts rubbing against my arms so I needed the bandages," said Azarenka, the runner-up to Serena Williams in 2012 and 2013.
"It looks weird but I did what I have to do."
Azarenka, a two-time Australian Open champion, holds a 2-0 career lead over Halep, although their last meeting was back in 2012.