Adrian Gonzalez stroked a two-run double into the right field corner in the bottom of the ninth inning Sunday to lift the Los Angeles Dodgers to a 5-4 win over the Arizona Diamondbacks.
The game-winning hit scored Mark Ellis from second base and Shane Victorino from first.
The Dodgers split the four-game series, winning the last two after dropping eight in a row to their NL West rivals.
Matt Kemp homered for the first time in nearly a month for Los Angeles.
Miguel Montero hit a two-run homer and John McDonald had a solo shot for the Diamondbacks, who fell to 2-8 in their last 10.
Arizona closer J.J. Putz (1-5) allowed Gonzalez's walk-off hit after giving up a single to Ellis and a walk to Victorino. It was his fourth blown save of the season.
Ronald Belisario (4-1) worked around a double in the top of the ninth and got the win in an inning of work.
Gonzalez's one-out hit gave him eight RBI as a Dodger. He turned on an 0-2 fastball, sending it nearly to the wall before Diamondbacks right fielder Justin Upton could get to it.
"We tried to elevate the pitch to Adrian but it stayed out over the plate," said Montero, the Arizona catcher. "He's a good hitter and he put a good swing on it."
Ellis scored easily and Victorino beat the relay throw home with a slide, capping the comeback victory.
"To finish the game like that is amazing. Give credit to the guys getting on before me," said Gonzalez. "I was looking for a fastball. When I hit it I knew it was going in the corner."
Dodgers starter Chris Capuano gave up three runs in five innings and remained winless in his last four outings. Wade Miley went 6 2/3 innings for Arizona, also allowing three runs.
Kemp led off the second inning with his 18th homer of the season and first since Aug. 8 against Colorado. Upton came close to catching the ball, which hit off the top of the wall.
McDonald tied the game at 1-1 with a leadoff homer in the third, his fifth, and Arizona took a 3-1 lead on Montero's two-run blast in the fourth, his 15th of the season.
Kemp drew a one-out walk in the sixth, went to third on Hanley Ramirez's double and scored on Andre Ethier's ground out to get the Dodgers within 3-2.
The Diamondbacks pushed their lead to 4-2 on McDonald's RBI single off Shawn Tolleson in the seventh and Victorino had an RBI base hit off Miley in the bottom of the inning.
"We just kept hanging in there and the guys kept coming back," said Dodgers manager Don Mattingly.
Bobby Abreu struck out leading off the ninth inning as a pinch hitter after being called up by the Dodgers from the minors before the game.
The Diamondbacks will continue a 10-game road trip in San Francisco starting Monday ... The Dodgers will finish a seven-game homestand against the Padres beginning Monday ... The teams will face each other for the last time this season in a two-game series at Arizona on Sept. 11 and 12. The Diamondbacks are 10-6 against the Dodgers this season.