Top seed Nadal never settled, slumping a set behind before taking a medical timeout when a break down in the second set after hurting himself stretching for a forehand and grimacing in pain.
He battled on but was in clear discomfort with his movement hampered.
His wife Mery was seen in the crowd in tears.
“It was pretty tough to stay mentally engaged but I found a way to just pull it out,” said McDonald.
“He’s an incredible champion, he’s never going to give up regardless of the situation. I was trying to stay focused on what I was trying to do and he kind of got me out of my rhythm, and I just got through it.”
The last time Nadal fell so early at a Grand Slam was at the Australian Open in 2016, when he departed in the first round.
The pair had met once before, also in the second round of a Grand Slam. On that occasion, at the 2020 French Open, Nadal dropped just four games in a comfortable victory.
This time McDonald was always in control with Nadal immediately on the back foot, broken on his first service game, with the American bursting out to a 4-1 lead.
Nadal complained to the umpire that he was being rushed on his serve, before clawing a break back. He earned another break point at 4-5 to level it up, but the American held on and clinched the set.
Nadal left the court at the changeover, but it didn’t help, with his serve again failing to fire, broken early once more as McDonald continued to dominate.
The Spaniard was on shaky territory, but as he has done so many times before, he found a way to claw back and level the set at 2-2.
But the errors began to creep in again and he was broken again before hurting himself at 15-30 in the eighth game, which he lost before gingerly walking back to his seat.
The physio was called and he could be heard saying “hip” in Spanish before leaving the court for a medical timeout with wife Mery in tears in the players’ box.
He returned and gamely carried on but was a shadow of his former self.
Nadal created history on the same court last year with his five-set victory over Daniil Medvedev in the final.
It saw him claim ownership of the record for most Grand Slam men’s singles titles on 21, ahead of Djokovic and Roger Federer.
He added a 22nd at Roland Garros, while Djokovic won Wimbledon to move onto 21.