Nadal remains on track for a potential semifinal against five-time champion Roger Federer in the bottom half of the draw. The top half was rocked by the upsets of top-ranked Novak Djokovic and No. 3 seed Alexander Zverev.
"The difference between players is not huge. It's small gaps," Nadal said about the upsets. "Is true that for the last 10 years didn't happen very often."
Krajinovic hadn't dropped a set in winning his first three main-draw matches after two victories in qualifying to get into the $8.3 million event. But he couldn't overcome Nadal, who lost his serve just once in the 1½-hour match in sunny and windy conditions.
"Probably played a little bit worse today than yesterday," Nadal said. "Maybe because of the conditions."
Seeking a record sixth title at Indian Wells, Federer defeated Kyle Edmund 6-1, 6-4 in 64 minutes in front of former greats Pete Sampras and Rod Laver.
"I was relieved I got through that one,'' Federer said. "He's got everything in the game. It's just a matter of keeping improving, keep plugging away, and then he will make big results again. He knows that.''
Federer will face Hubert Hurkacz for the first time in the quarterfinals.
The upsets weren't limited to the men's draw, as Naomi Osaka, the world's top-ranked woman, also lost in straight sets a day earlier.
And Miomir Kecmanovic, a 19-year-old Serb ranked 130th in the world, advanced when Yoshihito Nishioka of Japan retired after losing the first set 6-4. Nishioka sought treatment on the court before calling it quits.
Andreescu won the first nine games against Muguruza. The 20th-seeded Spaniard called for her coach while trailing 4-1 in the second set. He urged her to "change something.''
"I felt like every time I was trying something different, she was coming up with better shots,'' Muguruza said. "She was keeping her high level all the time.''
Andreescu broke Muguruza at love and then served out the match after a deuce game, hitting consecutive forehand winners.
Andreescu has been stretched to three sets just once -- in the first round. She then beat 32nd-seeded Dominika Cibulkova, Stefanie Voegele and No. 18 seed Wang Qiang before taking out Muguruza in her Indian Wells debut.
Andreescu is the third wild card in tournament history to reach the semifinals. Serena Williams was the most recent, in her return to the desert in 2015.
"It's incredible what I've achieved the last couple months,'' Andreescu said in an on-court interview. "I'm beyond grateful.''
She was runner-up at Auckland and made the semifinals in Mexico before coming to the desert.
Kecmanovic became the first lucky loser to reach the quarterfinals since the tournament achieved Masters 1000 status in 1990. 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 funny that somebody other than Novak is still in," Kecmanovic said of his famous countryman.
Kecmanovic got another dose of luck when he received a wild card for next week's tournament in Miami.
"I'm going to get a ticket because this is just nice," he said, joking about buying a lottery ticket.
Information from The Associated Press was used in this report.