SAN FRANCISCO (AP) Baseball fans gasped in horror when Robbie Ray was struck in the head by a line drive earlier this summer.

These days Ray isn't expecting anyone to feel sorry for him. The lefty has been as dominant as ever since coming off the disabled list.

Ray won his fifth straight start and A.J. Pollock 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.

''It's almost a blessing in disguise, to be able to take that time off and get my mind right get my body right, I feel like it's helped out,'' Ray said. ''Honestly, I feel stronger now with everything, I feel in synch. Ready to keep it going.''

Arizona reduced its magic number for clinching its first postseason berth since 2011 to seven.

The Diamondbacks trailed 2-1 when Pollock 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.

''You've got to get some runners on and put some pressure on him, because he was really, really on a roll there,'' Pollock said. ''They did a great job in front of me and I was able to get just enough of that down the line. That's baseball man, just enough to get the runners in.''

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.

''I hate to lose, everybody hates to lose,'' Samardzija said. ''That's the way it goes. It's frustrating.''

CLOSE CALL

Ray was nearly hit with a line drive when Kelby Tomlinson singled up the middle in the third inning.

GIANT CLAIM

The Giants claimed INF Engelb Vielma from the Minnesota Twins. They transferred INF/OF Michael Morse to the 60-day disabled list to make room for the 23-year-old defensive standout on their 40-man roster.

AGELESS MARVEL

Comic book legend Stan Lee, 95, yelled ''play ball'' from the field before Friday's game.

TRAINER'S ROOM

Diamondbacks: OF J. D. Martinez was a late lineup scratch with neck stiffness and day-to-day, Diamondbacks manager Torey Lovullo said. 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, 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.

Giants: Closer Mark Melancon is back with the team and has started rehabbing after undergoing pronator surgery on his right forearm earlier this week. There were no complications with the procedure, manager Bruce Bochy said. ... RF Hunter Pence left the game in the eighth inning with back spasms after diving for Descalso's fly ball in seventh inning. ... OF Gorkys Hernandez went into Friday's game as a defensive substitute in center field despite suffering a left wrist sprain that Bochy said has been bothering him the past few weeks.

UP NEXT

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.

---

More AP baseball coverage: https://apnews.com/tag/MLBbaseball

Copyright 2017 by STATS. Any commercial use or distribution without the express written consent of STATS is strictly prohibited.