SAN FRANCISCO -- Robbie Ray won his fifth straight start and A.J. Pollack hit a two-run double as the Arizona Diamondbacks defeated the San Francisco Giants 3-2 on Friday night.
Ray (14-5) struck out 10 and gave up two runs (one earned), six hits and no walks as the Diamondbacks won for the 19th time in 24 games and for the eighth straight time on the road.
Ray has a 1.39 ERA in his last five starts since coming off the disabled list with a concussion after getting hit by a line drive on July 28.
Arizona reduced its magic number for clinching its first postseason berth since 2011 to seven.
The Diamondbacks trailed 2-1 when Pollack doubled in two runs off Giants starter Jeff Samardzija (9-14) in the seventh inning.
Daniel Descalso started the rally with a two-out single that snapped a streak of 14 straight batters Samardzija had retired.
Samardzija gave up three runs, six hits and no walks in eight innings.
It marked just the eighth time this season that both teams allowed no walks.
Fernando Rodney pitched a scoreless ninth for his 37th save.
Ray was nearly hit with a line drive when Kelby Tomlinson singled up the middle in the third inning. Ray was on the DL for nearly a month after being hit in the head with a line drive on July 28.
Diamondbacks OF J. D. Martinez was a late lineup scratch with neck stiffness. Martinez is batting .451 (23 for 51) with 10 homers and 20 RBIs over his last 12 games.
C Jeff Mathis (fractured right hand) is with the team and is ramping up hand-strengthening exercises, manager Torey Lovullo said. Mathis will meet with surgeon Dr. Don Sheridan next week when the team returns to Arizona. He's been on the DL since Aug. 22.
Diamondbacks ace RHP Zack Greinke (16-6, 2.99 ERA) is 2-0 with a 2.03 ERA in his last four starts. He is 4-0 with a 1.66 ERA in six career starts at AT&T Park.
Giants LHP Madison Bumgarner (3-8, 3.55) is 0-3 with a 6.50 ERA in his last three starts. The 2014 World Series MVP is 1-4 with a 2.47 ERA in his last seven starts against Arizona.