SAN FRANCISCO -- Madison Bumgarner was so enthused by seeing Buster Posey hit a grand slam, he did the same thing the next inning.
Bumgarner became the first pitcher in 48 years to hit two grand slams in a season, and Posey also hit a slam Sunday that boosted the San Francisco Giants over the Arizona Diamondbacks 8-4.
"Everybody was excited to get a big hit like that," Bumgarner said of Posey. "That put us back in the lead. That's what big-time players do and he's a good one already."
Posey and Bumgarner became the first batterymates in major league history to hit grand slams in the same game.
"That's pretty cool," Bumgarner said. "This game is full of strange statistics. It seems like there is a first every day. It's crazy to get that many opportunities as a pitcher."
A double by Bumgarner helped set up Posey's slam in the fifth. Bumgarner homered the next inning -- he also hit a slam on April 11 against Colorado.
"All we could do was shake our heads," Posey said. "I was asking Rags (Dave Righetti) if any pitcher had ever hit two slams in the same season."
The last pitcher to launch two slams in a season was Tony Cloninger, who hit both in the same game for Atlanta on July 3, 1966, against the Giants at Candlestick Park.
Diamondbacks catcher Tuffy Gosewisch came out to talk to Matt Stites about how they were going to pitch to Bumgarner.
"Everybody knows he's a good hitter," Gosewisch said. "I wanted to go first pitch fastball down and away and it just ran back over the plate."
Bumgarner (10-7) threw 6 1-3 innings to end a personal three-game losing streak. He gave up four runs and 10 hits, striking out five.
Vidal Nuno (0-1) allowed four runs and six hits in five innings during his second start with Arizona.
The Giants finished the first half by winning five of nine. That followed a stretch of 18 losses in 23 games that cost them their lead in the NL West.
"The challenge for us is to look at the overall record," Posey said. "We're still in a good spot. We have to go forward."
Cody Ross hit a two-run homer for the Diamondbacks, who are 5-8 in their past 13 games. Martin Prado had three hits and drove in a run.
Nuno, acquired from the New York Yankees in a trade for Brandon McCarthy, had not allowed a run in his first 11 innings with the Diamondbacks before Posey's slam.
Bumgarner escaped a perilous sixth because of some fancy defensive plays, including his own.
Ender Inciarte and Prado each singled to start the inning. With Paul Goldschmidt batting, Bumgarner caught Inciarte taking off early for third for the first out.
Right fielder Hunter Pence, who also threw out a runner at third in the first inning, tracked down Goldschmidt's drive one step before slamming into the fence and third baseman Pablo Sandoval made a diving stop of Mark Trumbo's sharp grounder to end the inning.
Nuno breezed through the first four innings before running into trouble in the fifth. Bumgarner's one-out double started the rally. Pence was hit by a pitch and Sandoval, who had three hits, singled ahead of Posey, who homered into the left-field bleachers.
"I feel like we've been needing the big hit," Posey said. "I'm just trying to get a run on the board. Getting four across was great."
A double, an infield fielding error and a walk set up Bumgarner's slam in the sixth against Stites. Bumgarner earlier victimized Jorge De La Rosa of the Rockies.
"We had a good conversation about how we were going to attack Bumgarner," Stites said. "I just missed my spot. He's been swinging it well all year."
NOTES: Goldschmidt went 0 for 4 and had his career best streak of safely reaching base end at 32 games. ... Giants 1B Brandon Belt was a late scratch due to back tightness. ... INF Marco Scutaro was a little sore according to Giants manager Bruce Bochy and was given the day off. ... Posey has three career grand slams, including the post-season. ... Arizona manager Kirk Gibson said he was going to spend part of the All-Star Break watching his son play in the Cape Cod League. ... Ross' homer gave him 501 RBIs for his career. . The Giants announced their rotation coming out of the All-Star Break, with Bumgarner opening Friday at the Miami Marlins, followed by RHP Tim Hudson, RHP Tim Lincecum, RHP Ryan Vogelsong and RHP Matt Cain.