Los Angeles: Yasmani Grandal’s RBI single capped a five-run, seventh-inning rally that carried the Los Angeles Dodgers to a wild 9-7 victory over the Arizona Diamondbacks on Friday night.

Joc Pederson and Chase Utley each hit two-run home runs in the deciding rally as the Dodgers erased a 7-3 deficit and improved to 17-9 since June 26.

Three batters after Corey Seager doubled against Zac Curtis (0-1), Grandal hit a 2-1 pitch from Randall Delgado into center field, scoring Seager from third with the tiebreaking run.

Los Angeles pulled one game behind the division-leading Giants, the closest the Dodgers have been to first place since May 15.

Los Angeles sent 10 men to the plate in the bottom of the seventh, a half-inning after the Diamondbacks sent 11 men to the plate and scored seven runs.

Paul Goldschmidt capped a three-hit night with a bases-loaded double off Pedro Baez (3-2) that finished off Diamondbacks’ rally consisting of six hits and a pair of walks against five Dodger pitchers.

Arizona lost for the eighth time in their last 10 games.

With the Dodgers trailing 7-3, Pederson, who also had a two-run double in the second, tied his career-high with four RBIs with a two-run homer off Daniel Hudson, pulling the Dodgers to 7-5.

After Scott Van Slyke walked, Utley hit the first pitch he saw from Curtis (0-1) over the right-center field wall to tie the score.

Seager then scored the tiebreaking run later in the inning and added an RBI double in the bottom of the eighth for the final margin.

Kenley Jansen retired the final four Arizona hitters for his 31st save.

The Diamondback’s seventh-inning explosion squashed Kenta Maeda’s bid to become the first rookie to win 10 games this year.

Maeda held the Diamondbacks to two runs and four hits, retiring 16 of 17 hitters as he shut out Arizona through six innings. He struck five and did not walk a batter.

Over his last four starts, Maeda has struck out 26 and walked one over 23 innings.

Rookie Andrew Toles notched up his first career RBI for Los Angeles.