PHOENIX -- Pinch-hitter Aaron Hill's double produced the go-ahead run in the seventh inning off Oakland ace Sonny Gray, Paul Goldschmidt homered and the Arizona Diamondbacks rallied for a 6-4 victory over the Athletics on Friday night.

Hill drove in Chris Owings, who led off the inning with a double, to put the Diamondbacks in front 3-2. The A's, ahead 2-0 until the sixth, lost their third straight and are 4-12 over their last 16 games.

Goldschmidt crushed an offering from switch-pitcher Pat Venditte, who was throwing left-handed, off the bottom of the video board in center field for a two-run homer in the seventh as Arizona scored four runs in the inning. Goldschmidt's home run traveled with an exit speed of 112 mph, according to MLB Statcast, making it the hardest ball hit by the All-Star slugger this season.

More from FoxSports

The Diamondbacks are 10-5 in interleague play this season and ended a four-game losing streak with their sixth straight win over Oakland at home.

The teams hadn't played each other since 2012.

Gray (12-6) lasted 6 1/3 innings and allowed four runs, two earned, with five strikeouts and two walks. He had been 8-2 on the road this season before Friday.

Randall Delgado (5-3) pitched one inning of scoreless relief for the win.

Oakland took a 2-0 lead on doubles by Marcus Semien and Mark Canha sandwiching Billy Burns' run-scoring single. Burns and Canha drove in a run each with two outs against Diamondbacks starter Chase Anderson.

Anderson, however, settled down and left with a no-decision after six innings, allowing five hits, striking out three and walking one.

The Diamondbacks didn't score until the sixth, as two passed balls by catcher Stephen Vogt helped put runners on the corners with one out.

Gray struck out Goldschmidt but Vogt lost the ball on the third strike, allowing Ender Inciarte, who had walked, to move to third base and Goldschmidt to make it to first. Then David Peralta laced a double into right field to drive in Inciarte, and with runners at second and third, Welington Castillo's sacrifice fly drove in Goldschmidt to tie the score at 2.

Josh Reddick, who made the catch on the sacrifice fly, sent a strong throw toward home but Canha cut it off. Reddick gestured angrily after the play, throwing his glove hand up in disgust.

Brett Lawrie's two-run home run into the upper deck in right field completed the scoring. Brad Ziegler got two outs for his 22nd straight converted save chance.

MANAGERS AND FRIENDS

Diamondbacks manager Chip Hale and A's manager Bob Melvin faced each other for the first time since Hale was named Arizona's manager in October 2014. Hale was a third base and infield coach on Melvin's staff from 2007-09 in Arizona and bench coach with Melvin's Oakland staff from 2012-14.

TRAINER'S ROOM

Athletics: 1B Ike Davis had successful arthroscopic left hip surgery on Thursday in Vail, Colorado, the club announced. The procedure repaired the torn labrum in Davis' left hip.

Diamondbacks: Relief pitcher Daniel Hudson has a dislodged right index fingernail from being struck by a ball Thursday but could be available to pitch as soon as Saturday.

UP NEXT

Athletics: LHP Felix Doubront (1-1, 3.70 ERA) is scheduled for his 10th appearance and seventh start of the season. He is 1-0 with a 0.00 ERA against the Diamondbacks in his career, the win coming as a member of the Boston Red Sox in 2013.

Diamondbacks: RHP Jhoulys Chacin is coming off his Diamondbacks debut on Monday, when he allowed two earned runs in 6 1/3 innings in a loss to St. Louis. It's scheduled to be his first career start against Oakland.