"It's one of these victories today I'm really proud of", Nadal told reporters, declining to absolutely guarantee that he would be okay to play on Saturday.
Andreescu broke Muguruza at love and then served out the match after a deuce game, hitting consecutive forehand winners.
Nadal will next face 12th seeded Russian Karen Khachanov who defeated big serving eighth seed American John Isner by 6-4, 7-6 (7-1).
At the tournament in the United States, which is a Masters 1000 event and widely considered as one of the biggest events outside of the four Grand Slams, 37-year-old Federer eased through with a 6-1, 6-4 win over Great Britain's Kyle Edmund.
"Amazing is an understatement", said Andreescu, who is playing her first season as a professional. "It really helped me, and I used my serve to my advantage".
Standing in the way to her first Indian Wells final is Ukraine's sixth seed Elina Svitolina, who managed a comeback victory 4-6, 6-4, 6-4 over Czech Marketa Vondrousova later on Wednesday.
"She plays great tennis". The 27-year-old Serb got into the main draw when Kevin Anderson withdrew before his opening match with an elbow injury.
"It will be amusing that somebody other than Novak is still in", Kecmanovic said of top-ranked Djokovic, his famous countryman who was upset on Tuesday.
"I was relieved I got through that one", Federer said.
Nishioka retired after losing the first set 6-4, having first sought treatment on court.
The second-seeded Nadal is 5-0 against Khachanov, including a 5-7, 7-5, 7-6 (7), 7-6 (3) win in four hours, 23 minutes at the 2018 US Open.
Neither Federer or Nadal have dropped a set in their three matches at Indian Wells, a tournament Federer has won five times and Nadal three.
Dominic Thiem defeated Ivo Karlovic 6-4, 6-3 and will play the victor of the late fourth-round match between Philipp Kohlschreiber or Gael Monfils.
In other fourth-round action, hard-hitting Canadian Milos Raonic saved all three of Jan-Lennard Struff's break point opportunities to down the German 6-4 6-3. Naomi Osaka, the world's top-ranked woman, also lost in straight sets a day earlier.