LOS ANGELES -- The Dodgers were cruising along with a 21-game lead in the NL West. Now, it's been cut in half.
What a difference a week and a half made, all at the hands of the Diamondbacks.
Pinch-hitter Adam Rosales doubled in the go-ahead run in the seventh inning and Arizona overcame a rare deficit to win 3-1 on Wednesday night for its franchise-record 13th straight win.
"We're battling, grinding and sticking together, and those are things that make you win those close games and win 13 straight," Arizona manager Torey Lovullo said.
The D-backs' winning streak is the second longest in the majors this season behind Cleveland's current 14 in a row.
They swept the Dodgers for the second consecutive week for the first time since September 2005 to keep a comfortable lead in the wild-card race. Los Angeles has lost two series for the first time all year.
"They're the best team in baseball, they've been for the entirety of the season and we just have to find ways to win," catcher Chris Iannetta said.
Ketel Marte singled leading off the seventh against Luis Avilan (2-2). Rosales followed with a double to deep center, scoring the speedy Marte. David Peralta singled and J.D. Martinez was intentionally walked to load the bases.
Daniel Descalso was hit by Avilan, forcing in Rosales and extending Arizona's lead to 3-1.
The Dodgers have lost a season-high six in a row and 11 of 12, with six of those defeats to the second-place D-backs. Los Angeles still owns baseball's best record at 92-47.
"There's really nothing to say but we got to get a win," manager Dave Roberts said.
The Dodgers briefly owned a 1-0 lead, an accomplishment in itself. The D-backs hadn't trailed in their last 97 innings, the second-longest stretch in the majors since 1900, until Cody Bellinger's RBI groundout to second put Los Angeles ahead in the first.
But they didn't get a hit after the third inning.
Fernando Rodney pitched a perfect ninth to earn his 36th save.
The D-backs tied it 1-all in the second. A.J. Pollock reached on an error by shortstop Chris Taylor, stole second and came home on pitcher Taijuan Walker's RBI double.
Walker (9-7) allowed one run and four hits in six innings, struck out four and walked three.
Los Angeles starter Kenta Maeda gave up one unearned run and four hits in five innings. He struck out eight and walked one.
The D-backs earned their fourth consecutive series sweep and seventh straight road win, both firsts in franchise history.
Dodgers third baseman Justin Turner was ejected from the dugout between innings after arguing balls and strikes leading off the sixth. "I can't get thrown out in a 1-1 game," he said, "but at the same time I didn't think I did a whole lot to warrant ejection."
Diamondbacks 1B Paul Goldschmidt was available off the bench, although the team was being cautious because of stiffness in his right elbow.
Diamondbacks LHP Patrick Corbin (13-11, 3.83 ERA) takes the mound for the series opener Friday at home against San Diego. He is 5-5 with a 3.49 ERA in 14 career starts against the Padres, including 2-1 with a 3.38 ERA and 25 strikeouts in three starts this season.