Lowry pitched a two-hitter for his first complete game of the year and third of his career for the Giants, who moved out of last place or a tie for last in the NL West for the first time since July 31. He walked one, struck out six and recorded his first shutout since Aug. 3, 2004, against Cincinnati.
"Any time Barry hits a home run it's part of history and everybody likes to see that," Lowry said. "It takes a little pressure off the pitcher to have a lead."
Bonds, who flied out to right ending the first, sent the first pitch he saw from Livan Hernandez into the water beyond the right-field wall with two outs in the fourth for his 17th home run this season. The solo shot gave the Giants a 1-0 lead and helped Lowry (6-7) end a five-start winless stretch for his first victory since July 20 against San Diego.
It was the first splash hit of the season for the 42-year-old Bonds -- and the first by any Giants player. There have been 41 splash hits in the ballpark's 7-year history and 33 of those are by Bonds, who last did it on Sept. 18, 2005, against the Dodgers.
Bonds' previous homer was off Chan Ho Park on Wednesday at San Diego. The seven-time NL MVP, perhaps in his final season with San Francisco, passed Babe Ruth and moved into second place on the all-time homers list behind Aaron on May 28.
Three of Bonds' four career hits against his former teammate, Hernandez, have been home runs. He walked in the sixth to chants of "Barry! Barry!" and drew an intentional free pass in the seventh -- his 97th walk of the season and 36th intentional.
Lowry beat the Diamondbacks for the fourth straight time as the Giants took the opener after losing two of three to the first-place Los Angeles Dodgers in a weekend series.
"Great managing tonight, whew!" manager Felipe Alou joked. "We are out of last place by half a game. I've started checking the standings."
The left-hander retired the first 10 Arizona batters before Orlando Hudson singled to center in the fourth, then Luis Gonzalez grounded into an inning-ending double play to start a stretch of eight straight outs.
Lowry had faced the minimum number of batters until Hudson singled to right in the seventh and Gonzalez followed with a walk. After Conor Jackson fouled out to the catcher, Lowry plunked Carlos Quentin to load the bases before Chad Tracy lined out to center to end the threat.
"I was able to throw strikes where I wanted and I knew if I kept my pitch count down I'd be able to go deep into the game," said Lowry, who finished with 114 pitches.
Hernandez (10-10) was trying to win back-to-back starts since coming to the D-Backs in an Aug. 7 trade with the Washington Nationals. He beat the Giants in consecutive outings on Aug. 1 and 6 while with Washington. Hernandez gave up eight hits and one earned run in seven innings, struck out seven and walked two.
He gave up a two-out single to Mark Sweeney in the first and didn't allow another baserunner until Bonds connected. The Giants added two unearned runs in the seventh, when the Diamondbacks committed two errors.
"Bonds takes him deep," Arizona skipper Bob Melvin said. "Other than that, when you make more errors than you get hits, you're going to have a difficult time winning the game. ... Lowry was about as good as I've seen him."
Randy Winn drove in a run on a fielder's choice and advanced to second on a throwing error by Hudson, then scored on Omar Vizquel's RBI single moments later. Sweeney then singled to bring up Bonds with runners on the corners.
Winn drove in his second run of the game in the eighth with a single and the Giants scored again on another error.
- Lowry is 9-0 with a 2.42 ERA lifetime in August.
- Arizona won the last two meetings in the season series with San Francisco from Aug. 7-9 in Phoenix.
- Lowry is 5-1 in seven career starts against Arizona.
- Hall of Famer and former 49ers quarterback Steve Young attended the game.