Hanley Ramirez and A.J. Ellis hit back-to-back homers to start the 14th inning, and the Los Angeles Dodgers inched closer to the top of the NL West standings with a 7-5 win over the Arizona Diamondbacks.
The Dodgers, who swept the three-game set and won for the 15th time in their last 18 contests, moved within 1 1/2 games in the division. Los Angeles has gone 12-2 in its last 14 games against NL West opponents. The Dodgers have picked up eight games in the standings since being a season-worst 9 1/2 games out of first place in the NL West on June 22.
"To be able to get three is big for us because it's a two-game swing since we're playing them," Dodgers manager Don Mattingly said. "This is icing on the cake."
Also, LA is back at .500 (45-45) for the first time since April 30.
The Dodgers came into Wednesday 0-32 when trailing after seven innings, but Ellis singled in Jerry Hairston with the tying run with two outs in the ninth inning.
That hit came off Heath Bell and gave Arizona 19 blown saves this season, the most in the majors.
"I feel bad because I let everybody down and we should have won that game," Bell said.
Ramirez smashed Josh Collmenter's (4-2) first pitch of the 14th inning over the wall in right for his third RBI of the night. Ellis then homered to left.
Kenley Jansen (3-3) pitched the final two innings to get the win.
That was part of a two-hit, nine-inning scoreless performance for the LA bullpen.
Ramirez and Ellis each went 3-for-6, part of a 15-hit attack for the Dodgers. Adrian Gonzalez belted a solo homer in the seventh inning to start LA's comeback.
Paul Goldschmidt had a two-run double in the fifth inning for the Diamondbacks. Aaron Hill homered and also knocked in two runs for Arizona, which came into this series on a five-game winning streak.
Bell was one strike away from ending the game in the ninth inning, but Gonzalez, who fouled off five pitches during an extended at-bat drew a walk. Ramirez singled to center to advance pinch-runner Hairston, and he scored on Ellis' base hit to left field.
"He walked a guy with two outs," Arizona manager Kirk Gibson said of Bell. "It's unacceptable with the game on the line. And that guy scored by the way."
Andre Ethier grounded back to Bell to end the inning, and Paco Rodriguez retired the side in order in the bottom half to send the game to extra frames.
Chris Withrow played a big part in the win for the Dodgers by throwing three scoreless innings in only his sixth major league appearance.
It was also a game with some great defensive plays. The Diamondbacks flashed the leather twice over the first three innings. Left fielder Cody Ross robbed Mark Ellis of a home run on the game's first at-bat. A.J. Pollock made a diving catch in left-center to take away an extra-base hit from Mark Ellis in the third.
Hill homered to left field with one out in the first against LA starter Hyun- Jin Ryu, and his sacrifice fly in the third plated Pollock, who tripled.
Scott Van Slyke's sac fly scored Ramirez in the fourth inning, and the Dodgers went ahead, 3-2, in the fifth on Ramirez's two-run double off the base of the wall in center. They filled the bases with one out later in the inning, but Will Harris was summoned from the bullpen and got Van Slyke to ground into a double play.
Goldschmidt's double to right-center field scored Pollock and Hill in the bottom of the fifth, and it became 5-3 on Martin Prado's single to left field.
Gonzalez homered to right off David Hernandez to begin the seventh.
Dodgers right fielder Yasiel Puig struggled with a 1-for-7 effort and three strikeouts ... Ryu allowed seven hits and five runs over five innings, while Arizona starter Tyler Skaggs was lifted after giving up eight hits and three runs in 4 1/3 frames ... Major League Baseball upheld the two-game suspension of Dodgers second baseman Skip Schumaker from the June 11 brawl. He will also miss Thursday's game against Colorado.