PHOENIX -- Speed and a terrific bullpen breathed a bit of life into the playoff hopes of the San Francisco Giants.
Pinch-hitter Fred Lewis beat out a double-play grounder with the bases loaded to drive in the go-ahead run in the eighth inning and five relievers shut down Arizona in the Giants' 5-4 victory over the Diamondbacks on Monday night.
"Thank goodness for speed," San Francisco manager Bruce Bochy said. "That's a pretty routine double play ball for anyone else."
The victory moved the Giants within four games of idle Colorado in the NL wild-card chase with 12 games to play.
When Lewis hit the sharp bouncer to second, he knew what he had to do.
"I was just trying to get down the line as fast as possible," he said. "I came up with the big hit and hustled."
Pablo Sandoval doubled and singled for the Giants, who took advantage of three Diamondbacks errors.
The Giants' runs came on a single, an Arizona error, two groundouts (including Lewis') and a sacrifice fly.
"That's us," Bochy said. "We scratch and claw for lots of runs, and we executed a perfect bunt that helped us."
Manager A.J. Hinch called it "a night of really, really poor execution" by the Diamondbacks.
"We had two bunts on offense we didn't get down, we had three errors, numerous leadoff walks. It's not winning baseball," he said.
Jeremy Affeldt threw a scoreless eighth for his major league-leading 32nd hold. Brian Wilson allowed a two-out single to Stephen Drew in the ninth, then struck out Upton looking on a 3-2 pitch for his 35th save.
Reliever Esmerling Vasquez (3-3) walked Travis Ishikawa to lead off the eighth, then Aaron Rowand laid down a beauty of a bunt. Vasquez and second baseman Ryan Roberts collided trying to field it, leading the Arizona pitcher to throw wildly past first base.
The Diamondbacks' third error of the game put runners on second and third with no outs. Roberts hurt his left leg on the play and had to leave the game.
After Nate Schierholtz popped out to shortstop, Eugenio Velez was walked intentionally to load the bases and bring up Lewis, who hit a sharp grounder to second baseman Augie Ojeda, who threw to Drew at second for the force, but Lewis crossed first just ahead of the relay as the go-ahead run scored.
Hinch said a slight bobble of the ball by Drew made the difference.
"It probably has to be a perfect play to turn it on a guy like him [Lewis]," Hinch said. "As soon as there was one little hesitation, he's safe."
Sergio Romo (5-2) pitched 2/3 of an inning to get the victory.
Neither starter made it through the fifth inning.
The Giants took a 4-2 lead with two runs in the fifth when Sandoval hit an opposite field shot off the fence in left for his NL-leading 43rd double, then scored when Bengie Molina singled up the middle. Juan Uribe singled to end starter Billy Buckner's night.
Arizona tied it in the fifth on Upton's soft bases-loaded single to short right field. That finished the evening for Barry Zito, who allowed four runs -- three earned -- and six hits in 4 1/3 innings. He struck out four and walked three.
Sanchez was injured when he went up to catch a high throw back to the infield from Rowand after Justin Upton had flied out to center. He stayed in until Reynolds, the next batter, homered, then had to be helped off the field.
The Diamondbacks went up 2-1 in the first when Young drew a leadoff walk, then with two outs, Reynolds hit the first pitch from Zito into the left-field seats, giving him 99 RBIs for the season.
Reynolds said history had shown Zito would start him off with a fastball inside.
"I was just sitting on it and got it," Reynolds said.
Reynolds did not strike out, remaining one shy of the major league record of 204 he had last year. He has struck out once in the last three games. ... Sandoval is hitting .475 against Arizona (19 for 40) ... Sanchez's single was his first hit in 13 career at-bats against Arizona.
Andrelton Simmons camps underneath what looks to be a routine fly ball, but the ball bounces off his glove forcing him to catch it with his barehand as he falls to the ground.
Francisco Lindor smashes a two-run home run to right-center field to give the Indians a 4-2 lead over the Angels.
Diamondbacks' David Peralta scores one with his double to give Arizona the 7-6 lead over San Diego.
Aaron Altherr shines in the Phillies' victory, hitting the go-ahead homer in the eighth inning while Odubel Herrera makes a fantastic catch at the wall in the bottom of the ninth, sending the Dodgers to their fourth straight loss.
Padres' Rocky Gale and Christian Villanueva both hit their first career home runs using Gale's bat.
A court in the Dominican Republic has sentenced former MLB outfielder Raul Mondesi to eight years in prison on corruption and mishandling of public funds while serving as mayor of his hometown of San Cristobal.