Murray, playing for the first time since pulling out of Wimbledon, converted his seventh match point to clinch a three-set victory and set up a meeting with fellow Briton Kyle Edmund in the second round in Washington DC.
The two-time Wimbledon champion toiled for more than two and a half hours against world number 80 McDonald, eventually taking the match 3-6 6-4 7-5, just his second win of an injury-interrupted year.
“It was a tough, tough match,” the 31-year-old said on the ATP Tour website.
“It could have gone either way. Obviously if you lose a match like that, it’s a tough one. When I lost to (Teymuraz) Gabashvili here (three years ago), I lost serving for the match, so I was thinking about that a little bit, too. It is just nice to get through.
“I wasn’t dictating many of the points. I wasn’t hitting the ball that cleanly. I just fought and tried to make it tough for him.
“Made a few little adjustments here and there. But mentally, it was a big one to get through.”
McDonald, 23, broke two of Murray’s opening three service games and wrapped up the first set 6-3 inside 40 minutes.
But Murray drew things level, taking a crucial game nine in the second for a 5-4 lead and serving out the set.
A 73-minute deciding set followed, in which Murray took an early break and found himself 5-4 up and serving for the match.
McDonald saved five match points and converted his second break point to draw things level at 5-5.
Murray broke back immediately for a 6-5 lead following a controversial call when McDonald’s racket was adjudged to have crossed the plane of the net at 30-30. The former British number one then made no mistake in serving out the match.
The former world number one, now ranked 832, is continuing his protracted recovery from long-term hip trouble.
Murray had surgery on his right hip in January, only returning to action on June 18, losing to Nick Kyrgios at Queen’s.
He later overcame Stan Wawrinka at Eastbourne, only to lose in straight sets to Edmund two days later and then withdraw from Wimbledon. The Citi Open is just his third tournament of the year.
He faces Edmund again in Washington and admits he has to up his game.
“I started off the match serving very poorly,” he said. “I was struggling on my serve and didn’t feel like I had much rhythm.
“I haven’t played in the darkness or under the lights in a very long time and I felt like my rhythm was off on serve, my timing a little bit. That started to get a bit better as the match went on, so that helped.
“I made a few less mistakes, but I would like to play better tennis in the next match.”