LOS ANGELES -- Robbie Ray pitched six innings of three-hit ball, A.J. Pollock and Paul Goldschmidt hit back-to-back homers in the seventh, and the Arizona Diamondbacks beat the Los Angeles Dodgers 8-0 on Tuesday night.

The Dodgers lost their fourth straight game, equaling their longest slide of the season, and their magic number for clinching their third straight NL West title remained at seven pending the outcome of San Francisco's game at San Diego.

The Diamondbacks have won the first two games of this four-game series after losing their previous nine at Dodger Stadium. But the Dodgers have aces for the next two -- major league ERA leader Zack Greinke on Wednesday night and reigning NL MVP Clayton Kershaw on Thursday afternoon.

More from FoxSports

Ray (5-12) struck out seven, walked two and escaped a bases-loaded jam in the first inning. The 23-year-old left-hander is 2-8 with a 4.54 ERA over his last 13 outings. The other win during that stretch was against the Dodgers at Chase Field on Sept. 11, a 12-4 rout.

Lefty Alex Wood (11-11) allowed two runs, three hits and no walks in 6 1/3 innings and struck out six in his rematch against Ray.

Wood was coming off a 2-0 home win against Colorado last Wednesday, when he gave up one hit and no walks in eight innings while throwing 78 pitches.

Arizona's first run on came in the fourth, when Nick Ahmed led off with a double, advanced on Chris Owings' sacrifice and scored on Pollock's groundout.

Pollock chased Wood with his 18th homer, a one-out drive that hit the top of the center field fence and bounced over.

Chris Hatcher relieved Wood, and Goldschmidt greeted him with a drive that just cleared the wall in right-center. It was his 30th home run, making him the fourth player in Diamondbacks history with multiple 30-homer seasons along with Steve Finley, Luis Gonzalez and Mark Reynolds.

Goldschmidt is hitting .340 with 20 homers and 61 RBIs in 74 career games against the Dodgers -- the highest totals by any player against them since Goldschmidt made his big league debut on Aug. 1, 2011. He is 5 for 10 against Wood with three homers and five RBIs.

The Diamondbacks broke it open with five runs in the ninth. Jarrod Saltalamacchia hit a bloop RBI single and scored on a bases-loaded wild pitch by Adam Liberatore. Brandon Drury hit a three-run homer -- his first of the season.

TRAINER'S ROOM

Diamondbacks: SS Nick Ahmed left the game because of a jammed lower back.

Dodgers: Manager Don Mattingly said the club is taking every precaution this week to make sure that the high blood pressure that prevented closer Kenley Jansen from pitching the final game of the last series at Colorado in early June won't re-occur.

UP NEXT

Diamondbacks: RHP Chase Anderson (6-6) pitched six innings of two-hit ball on May 3 in his only previous start at Dodger Stadium.

Dodgers: Greinke (18-3) is 13-1 over his last 15 starts and owns a major league-leading ERA of 1.65. He held the Diamondbacks to three hits over eight scoreless innings the last time he faced them on Sept. 13.