Adam LaRoche homered twice and the Arizona Diamondbacks matched a team record by connecting six times in a 13-1 rout Wednesday night.
"It was a nice little boost, especially right now with us getting shut down offensively the way we have in some of our past games," LaRoche said.
Arizona had lost nine of 11 coming into this one and had scored three or fewer runs in eight of those games. It was shut out by Florida on Tuesday but found a zone Wednesday.
Kelly Johnson hit his NL-leading 12th homer while Justin Upton, Stephen Drew, and Chris Snyder also went deep for the Diamondbacks. San Francisco had allowed a league-low 24 home runs going into the game.
LaRoche finished with four RBIs and hit his first home runs since belting two against the Cubs on April 29.
"It's been a long time, hasn't it?" said LaRoche, who recorded his 14th career multihomer game. "It felt good. I feel like I've been putting out some decent at-bats, just not really backing up a lot of balls and driving them. It was good to kind of find that groove a little bit."
Drew and Snyder each had three RBIs for Arizona, which ended a six-game home losing streak.
Ian Kennedy (3-2) struck out a career-high nine and allowed one run on three hits in eight innings.
"That's as much as you can ask from our team," manager A.J. Hinch said. "All the way around we played pretty flawless baseball. That was good to see and a long-time coming."
Todd Wellemeyer (2-4) remained winless on the road after giving up five runs on four hits in five innings.
Kennedy allowed a run on two hits in the first inning but shut the Giants down after that. Acquired in the offseason from the New York Yankees in a three-team trade that also included the Detroit Tigers, the right-hander set down 13 straight at one point and walked only three while throwing 116 pitches.
A comebacker from Aaron Rowand nailed him on his right thigh in the third inning, but Kennedy said that helped settle him down.
"Early on I was a little jumpy and it actually helped," he said. "It kept me staying back and under my legs and not trying to work too hard. It kept me under control."
Playing in front of 17,073, its smallest home crowd of the season, Arizona reached double digits in scoring for the fifth time this season and the second time in five games.
"We've shown that we can be an explosive offense. It's can we be a consistent offense?" Hinch said.
The Giants allowed a season high in runs and tied a franchise high for homers allowed. The last time it happened was April 19, 1996, at the Chicago Cubs.
"The whole staff tonight had trouble controlling the ball," manager Bruce Bochy said. "It was an off day for all of them."
Wellemeyer's struggles on the road continued. He fell to 0-3 and has given up 18 earned runs in 17 1/3 innings in four starts away from San Francisco. He allowed only four hits in this one, but three were home runs.
The Diamondbacks tied it at 1 in the second on a solo shot by LaRoche, went ahead 2-1 on Upton's homer in the fourth and pushed their cushion to four runs on Drew's three-run drive in the fifth.
Wellemeyer said the homers didn't come on hanging pitches.
"They went and got them," he said. "I mean hats off to them, but you can't leave anything over the plate to these guys at all.
Snyder and Johnson each added two-run homers later, and LaRoche had a three-run shot in the eighth.
The Giants took a 1-0 lead in the first on Pablo Sandoval's RBI single.
San Francisco activated 2B Freddy Sanchez from the 15-day disabled list prior to the game. Sanchez had missed all of spring training and the first 38 games of the regular season after undergoing surgery on his left (non-throwing) shoulder in December. OF Eugenio Velez was optioned to Triple-A Fresno to make room on the active roster. ... Arizona optioned OF Cole Gillespie to Triple-A Reno and called up OF Gerardo Parra before the game. ... The Giants fell to 4-11 against the NL West.