PHOENIX -- The Arizona Diamondbacks desperately needed a win to avoid falling further behind in the race for a National League wild-card berth, and a pitcher who hadn't won at home in 2 1/2 months delivered.
"The simplest way to put it is that I felt more like myself," Kelly said after his first win at Chase Field since June 2. "I went out there with a specific game plan of throwing everything at any time.
"Everybody in here still believes we can still make a run at this thing, we can still do something," Kelly added. "Obviously losing four in a row, I'd be lying if there wasn't an extra incentive on today's game."
Wilmer Flores and David Peralta homered, and Kelly (9-12) struck out five. Madison Bumgarner (8-8) took the loss after giving up four runs on six hits in six innings of Bruce Bochy's final game at Chase Field as Giants manager.
Bochy, who is retiring at season's end, was honored before the game with a videoboard and public address announcement. He then walked to home plate, where Diamondbacks manager Torey Lovullo presented him with an all-inclusive, four-night stay at a lodge in Montana.
"It was classy for him to come out and what the Diamondbacks did for me," Bochy said. "It was a good series. You come in here and take three out of four, hey, you have to feel good about that."
The Diamondbacks struck early with three first-inning runs. A two-out fielding error in right field by Austin Slater allowed Eduardo Escobar to take third base on a double, and after a walk, Adam Jones tripled when the ball got past Giants center fielder Kevin Pillar to drive in two runs.
Josh Rojas drove in Jones for a 3-0 lead off Bumgarner, who had nine strikeouts.
Flores hit an 0-2 pitch from Bumgarner in the fifth deep into the left field seats for his sixth home run of the season. Flores is 12 for 19 (.632) with four home runs and seven RBI in his last six games.
"It's one of the hardest throws for a second baseman," Flores said. "I had to make sure I made a strong throw."
Peralta's seventh-inning line drive just cleared the right field fence and landed on the pool deck, his 12th of the season.
A FAREWELL TO CHASE
Bochy has spent decades coming to Arizona as a player, coach and manager. He said he thought about his final game in Phoenix walking into the ballpark Sunday morning. He managed the National League at the 2011 All-Star Game in Phoenix and after Sunday finished 69-53 at Chase Field as manager of the Giants.
"The last day is usually when it hits me," he said. "I thought about all the games I've had here, big games, over the years. The first year was `98, so that was a good year. We went to the World Series that year (as manager of the San Diego Padres).
"I've seen some great teams here, great battles. Of course when they had (Randy) Johnson and (Curt) Schilling, they were as tough as anybody," Bochy added. "I'll miss coming here. They've done a great job here putting together a team and how they play."
The Giants called up infielder Abiatal Avelino, who grounded out as a pinch hitter Sunday, before the game from Triple-A Sacramento. Pitcher Travis Bergen was designated for assignment.
The Diamondbacks brought up right-hander Bo Takahashi from Double-A Jackson, with pitcher Stefan Crichton optioned to Triple-A Reno. Takahashi, 22, is the first Diamondbacks player born in Brazil and the sixth overall to reach the major leagues.
Giants: RHP Shaun Anderson was eligible to come off the 10-day injured list Sunday after a blister healed, but Bochy said he's likely to get a rehab start before being activated.
Diamondbacks: IF-OF Ketel Marte was out of the lineup a second straight game. He dealt with back tightness Saturday.
Giants: After an off day Monday, the Giants send RHP Tyler Beede (3-7, 5.77 ERA) to the mound against the Chicago Cubs and Cole Hamels at Wrigley Field to open a key three-game series against another NL postseason contender.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Moustakas, Cain lift Brewers past Padres 3-1
Mike Moustakas hit his 35th home run of the season, Lorenzo Cain also went deep and the Milwaukee Brewers beat the San Diego Padres 3-1 on Tuesday night to keep up their playoff push with their 11th win in 12 games.
Indians win 15th straight over Tigers with 7-2 victory
Adam Plutko pitched six effective innings, rookie Oscar Mercado homered and the Cleveland Indians beat Detroit 7-2 on Tuesday night for their 15th straight victory against the Tigers.
M's go deep 3 times to sink Pirates
Omar Narvaez and Austin Nola hit back-to-back homers, and Shed Long almost finds the river with a big solo HR as the Mariners blank the Pirates 6-0.
Mariners blank Pittsburgh after Pirates' Vázquez arrested
Marco Gonzales allowed six hits in seven innings, Austin Nola and Omar Narvaez hit back-to-back home runs and the Seattle Mariners beat Pittsburgh 6-0 on Tuesday night after Pirates All-Star closer Felipe Vazquez was arrested on multiple felony...
Betances has partial tear in Achilles tendon
Yankees reliever Dellin Betances suffered a partial tear of his left Achilles tendon when he landed awkwardly on the mound on Sunday, manager Aaron Boone said Tuesday.
Darvish K's 8 straight for Cubs single-game mark
Yu Darvish recorded eight straight strikeouts during Tuesday night's game against the Reds, setting a Cubs record for most consecutive strikeouts within a single game.