LOS ANGELES -- Over the past couple of weeks, the Arizona Diamondbacks are playing as well as the Los Angeles Dodgers did for so long this season.
Brandon Drury hit a grounder to third base that scored the go-ahead runs when Justin Turner's throw home got away, and the Diamondbacks won 3-1 on Tuesday night to match a franchise record with their 12th consecutive victory.
Arizona has built a comfortable cushion in the NL wild-card race, but still trails Los Angeles by 11 games in their division. The slumping NL West leaders have dropped five in a row and 10 of 11.
"It seems like it's timed up that we're playing good when they're going through a rough patch," Diamondbacks starter Zack Greinke said of his old team. "I wouldn't say it means too much."
Dodgers reliever Pedro Baez (3-4) issued consecutive walks to open the 10th, drawing boos for the second night in a row after he gave up four straight hits that led to four runs in a 13-0 loss to Arizona on Monday.
Baez retired J.D. Martinez, who tied a major league record with four home runs Monday, on a broken-bat groundout that left runners at second and third. Martinez went 1 for 5 and scored a run.
Drury grounded to Turner just inside the third base line, and he fired home to catcher Yasmani Grandal. The ball ricocheted off pinch-runner Chris Hermann's arm and then Grandal's forearm before bouncing away. Hermann and A.J. Pollock scored, Drury was safe at second and Grandal was charged with an error.
"I don't even know where the ball is after it hits him," Grandal said. "There's no time to react. You've got a runner coming straight at you and a ball being thrown very hard."
Despite playing without ailing slugger Paul Goldschmidt the last few days, Arizona equaled its franchise record for most consecutive wins set in June 2003. The victory earned the Diamondbacks their first season series win over Los Angeles since 2013.
"We're enjoying it," manager Torey Lovullo said. "The guys come in energized every single day. They rally around one another. They sense that something very special is happening here."
The Diamondbacks haven't trailed for 98 straight innings, tying the 1947 Brooklyn Dodgers for the third-longest streak by a major league team since 1912.
"When you're playing good baseball, you don't really know once the streak's going on," Pollock said. "I'm sure there's going to be a time where we're going to have to fight, but we can play on top. Pitchers are doing a good job of not giving up their lead."
The Dodgers tied their longest skid of the season, although they remain baseball's top team at 92-46.
"Might as well happen now and not in the playoffs," Grandal said.
David Hernandez (3-0) got the win in relief. Fernando Rodney earned his 35th save.
Chris Taylor singled for the Dodgers leading off the bottom of the ninth, but Curtis Granderson flied out and Taylor was thrown out at second for Arizona's second double play before Turner grounded out to send the game to the 10th.
"We're just on the wrong end of a few things," Turner said. "That's how the game goes."
The Dodgers tied it 1-all in the fifth on Grandal's leadoff homer.
"I didn't make a lot of mistakes, but I make one mistake a game," Greinke said.
Arizona took a 1-0 lead in the fourth on Daniel Descalso's RBI double that bounced off the lower
left-field wall, scoring Martinez, who doubled and went to third on a walk to Drury.
The Diamondbacks had runners on first and second with two outs in the ninth against closer Kenley Jansen, but pinch-hitter Rey Fuentes struck out swinging to end the threat.
Greinke gave up one run and four hits in seven innings. The former Dodgers star struck out six and walked one.
Los Angeles starter Hyun-Jin Ryu allowed one run and three hits in six innings, struck out seven and walked five. He was hit in the left calf on a comebacker by Pollock in the fifth, but walked it off.
BRINGING 'EM BACK
The Dodgers recalled outfielders Joc Pederson and Trayce Thompson from Triple-A Oklahoma City. Pederson returns after being optioned to the minors on Aug. 19 with a .215 batting average for Los Angeles. Thompson is back for his third stint with the Dodgers after hitting .212 with 33 RBIs in 95 games for Oklahoma City. Los Angeles manager Dave Roberts said Pederson deserves a chance after changing his swing mechanics. "Things are trending the right way," he said. Roberts said both players will get opportunities depending on pitching matchups.
Diamondbacks: 1B Paul Goldschmidt had a cortisone injection in his right elbow after inflammation was found during an MRI on Monday in Phoenix. He rejoined the team Tuesday and was available off the bench. Manager Torey Lovullo said he was being cautious with Goldschmidt, whose elbow is stiff in the mornings before it loosens up.
Dodgers: SS Corey Seager, limited to pinch-hitting duty last week because of a sore right elbow, returned as a pinch-hitter in the 10th inning. He singled with two outs.
Diamondbacks: RHP Taijuan Walker (8-7, 3.42 ERA) starts the series finale. He is 5-4 with a 2.82 ERA in 13 road starts, including 1-0 at Dodger Stadium.
Dodgers: RHP Kenta Maeda (12-6, 4.19) got hit hard on the road by the Diamondbacks last week, allowing seven runs and eight hits in three innings of an 8-1 loss. He is 3-3 with a 5.19 ERA in 10 career starts against them.