Murray, 34, a three-time major winner, was set to face Djokovic for the 37th time in a highly anticipated clash on clay at the ATP Masters 1000 event in the Spanish capital. It would have been the first time Murray and Djokovic played against each other since Djokovic won the Doha final in 2017.
"Unfortunately, Andy Murray is unable to take to the Manolo Santana Stadium due to illness," tournament organizers said in a statement on social media. "Instead, Andrey Rublev and Daniel Evans will open the day's play on centre court."
Murray, who had earlier said he would skip the clay-court season to protect his fitness, accepted a late wild card in Madrid and beat Dominic Thiem and Denis Shapovalov in his opening two matches. The former No. 1 hadn't won consecutive matches since January.
Ranked 78th in the world, the 34-year-old Murray has been making his way up the rankings since having hip surgery in both 2018 and 2019. He had arrived in Madrid with a 10-8 record in eight tournaments, losing in the Sydney final to Aslan Karatsev in January.
Djokovic is also trying to regain his best form after not being allowed to play in the Australian Open because he was not vaccinated. This is his fourth tournament of the season. He opened in Madrid with a two-set win over Gael Monfils.
Nadal's 1,050th career victory took more than three hours before he closed out the 6-3, 5-7, 7-6 (9) win over Goffin in only his second match after an injury layoff.
The fourth-ranked Nadal had beaten the 32nd-ranked Miomir Kecmanovic in straight sets in his opening match at the clay-court tournament, his first after missing six weeks because of a rib stress fracture.
"I knew before I arrived that this was going to be a complicated week," Nadal said. "Whatever happens now, to win two matches here is fantastic news for me."
Nadal was up 5-3 in the second set before being broken twice and squandering a couple of match points to allow Goffin to even the match. He also struggled in the third and faced four match points in the tiebreaker. The first was saved with an ace, and Goffin hit the net on the second. On the next two, Nadal needed a couple of perfectly executed drop shots to stay in the match.
"It was an incredible end to the match, but it should have never gotten to that point. I had it under control at 5-3," Nadal said. "But we know that things are not perfect for me right now; I have to accept that. I fought until the end. It's what I can expect from myself now."
The third-seeded Nadal -- the most successful player at the Madrid Open with five titles -- will next face Carlos Alcaraz, the youngster touted by many in Spain as Nadal's successor. The ninth-ranked Alcaraz marked his 19th birthday by defeating Cameron Norrie 6-4, 6-7 (4), 6-3. Tournament organizers greeted him with a cake on the court after the match, and the home crowd sang "Happy Birthday.''
Rublev, who beat Djokovic in the Serbia final, advanced to the quarterfinals after a hard-fought 7-6 (7), 7-5 win over Evans in nearly 2½ hours. The sixth-seeded Rublev converted just three of his 12 break-point opportunities.
Reuters and The Associated Press contributed to this report.