Their ninth win in 11 games protected the Pirates' one-game National League Central lead and moved them one giant step closer to entering the post-Sunday All-Star Game break atop the division.
Apparently a higher power protected McDonald himself. Soon after he'd chugged 270 feet from first base in the stifling heat to score the Pirates' first run in the third inning -- the kind of exertion known to derail pitchers -- a sudden thunderstorm while the Bucs were still batting prompted a 27-minute rain delay.
"Yeah, the delay came right on time. The baseball gods must really like me right now," said McDonald.
Cue the "team of destiny" storylines here.
With McDonald getting his second wind, a capacity crowd saw him improve his home record to 5-1 with a 1.69 ERA by holding San Francisco to a run and four hits.
That was the easy part of Pittsburgh's 47th win. When Jason Grilli fanned the side in the eighth, it remained simple. But when Joel Hanrahan entered in the ninth, matters became complicated.
This is what Hanrahan endured: one bunt single compounded by a throwing error, two slow grounders into the 6.5 hole, and a rocket down the right-field line. Result: Three outs and save No. 23, thanks largely to Clint Barmes.
Despite having spent most of the day on his heels watching McDonald and Grilli send Giants back to the bench with their bats, Barmes was quick enough to backhand and sidearm accurate throws to first on both grounders by Ryan Theriot and Melky Cabrera. First baseman Casey McGehee made a brilliant scoop of the first, short-hopped throw, but the second was all Barmes.
"Unbelievable play," Hanrahan said of Theriot's roller. "When he hit it and I saw Barmes field it, I'm thinking, 'Is he even going to throw it?' So to make that play ... and the pick by Casey was unbelievable.
"Then a couple of pitches later, we get an instant replay of it. It was fun to watch. That's why Barmes is here; signing him, we knew defense was his thing, and he's been nothing but great so far."
When Garrett Jones ran down Buster Posey's liner, the brilliance of McDonald's prior work was saved.
"I had a pretty good arsenal today -- slider was better than it has been, the fastball command was good, threw some good changeups," McDonald said, still managing to sound modest on a day he had no reason to.
Pitchers are famous for downplaying who they are up against on any given day. "I'm pitching against the other lineup, not so-and-so," is the typical disclaimer.
Their managers apparently get a different view. Thus Clint Hurdle had declared before his McDonald faced off against the Giants' Ryan Vogelsong:
"I really think James is looking forward to the matchup. I really do."
McDonald really did, issuing no walks while reaching double figures in strikeouts. He became the first Pirates pitcher to go at least seven innings and strike out 10 without a walk since former Pittsburgh -- and San Francisco -- righty Jason Schmidt, on Aug. 23, 1996.
"I love the 0-10. That's good stuff," Hurdle said. "Major League top-shelf stuff."
McDonald reached double figures in strikeouts for the third time this season. But he did not issue a walk for only the second time, hence that part of his line was "the big thing for me," he said.
"Straight A's," said Hurdle, grading McDonald's performance. "Vogelsong pitched a good game. James pitched a better game. Good downhill angle on his fastball, the breaking ball for strikes and for chase ... very efficient."
McDonald had walked in the third in front of Neil Walker's run-scoring double, his second two-bagger of the game. A couple of innings later, McDonald also singled to grab some more base time.
Walker's second double of the game had given the Bucs a 1-0 lead, which Michael McKenry doubled on a solo homer in the fourth, his seventh.
McDonald was working on a two-hit shutout when, with two outs in the sixth, the Giants stirred. Gregor Blanco singled and moved up on a wild pitch before scoring on Theriot's single to make it 2-1.
The Bucs immediately got that run back, Pedro Alvarez's clutch double in the bottom of the inning scoring Andrew McCutchen, who had led off with a single but was still rooted on first with two away.
"I just made too many mistakes to a team that's swinging the bat pretty good right now," Vogelsong said. "Obviously, [McDonald] is having a good season, and throwing the ball well. Going in, you know it's going to be a tough game. He pitched a little bit better than me today."
This was another emotional "homecoming" for Vogelsong, but it couldn't compare with his first return to the scene of his first Major League win. Before the baseball world got to know the new Vogelsong, before he re-established his big league credibility -- on April 28, 2011, he made his first start for the Giants right here, and beat the Bucs, 5-2, for his first victory since Sept. 14, 2005.