David Peralta (6) gets doused by teammates after his 11th-inning single helped the D-backs stave off a Dodgers sweep.

PHOENIX — Extra-inning heroics, a favorable bounce and six innings of scoreless relief helped the Diamondbacks cool off the Dodgers.

Jarrod Dyson hit a tying double in the eighth inning with the help of Chase Field’s new artificial turf, David Peralta had a game-ending single in the 11th, and the Diamondbacks avoided a three-game sweep with a 3-2 victory Wednesday.

“We’ve been walking through some very lean times. We’ve been battling through some injuries,” Diamondbacks manager Torey Lovullo said. “It’s one of those games that you feel like will push you in a very positive direction.”

The two-time defending NL champions entered with a season-high, seven-game winning streak and began the day 10½ games ahead of second-place Colorado in the NL West and 13 games in front of the Diamondbacks. The Dodgers, an NL-best 43-20, lost for just the second time in 13 games.

Dyson’s tying two-out double hit the lip of the artificial turf where it meets the grass and took a huge bounce over the glove of diving first baseman Max Muncy. Chase Field had grass from the ballpark’s opening in 1998 through last year.

Eduardo Escobar tripled off Scott Alexander (3-2) leading off the 11th, Ketel Marte was intentionally walked, and Peralta lined his first pitch to right.

“We needed this win,” Peralta said.

Zack Godley (2-4) pitched a perfect 11th for the Diamondbacks, who were outhit 7-5.

Will Smith hit a two-run homer in the third off Jon Duplantier, who allowed three hits over five innings with seven strikeouts in his second big league start.

Dodgers starter Kenta Maada gave up two hits in five innings and struck out seven. He retired his first nine batters before Dyson singled and scored on Peralta’s double.

Maeda was unhappy with the decision to lift him.

“I was a 100 percent ready to go back out there and pitch another inning,” Maeda said through a translator. “As a starting pitcher only pitching 70 pitches and going five innings deep, it is not a very pleasant thing. Yes, I was surprised with the decision to take me out of the game. I was pretty confident I could get those guys out.”

Dodgers manager Dave Roberts said he wanted to go with a fresh bullpen that included Julio Urías, who had not pitched since Saturday.

“With Urías rested, a very heavy left-handed lineup, I just felt Kenta gave us what he had and a chance to win the baseball game,” Roberts said.

Inside pitch

  • Arizona deployed an exaggerated shift to the right side of the field with one strike or two on Cody Bellinger in four of his five at-bats, moving Marte from second base to right field and moving right fielder Tim Locastro closer to the foul line. Bellinger, whose .370 batting average leads the majors, dropped a single in front of Marte in the sixth inning but was retired in his other three turns at the plate with the shift.
  • Locastro, who scored on Dyson’s double, has been hit by a pitch nine times in 31 major league games.
  • Dodgers infielder Matt Beaty was placed on the 10-day IL, retroactive to Wednesday, with a left hip flexor strain. Outfielder Kyle Garlick was recalled from Triple-A Oklahoma City.
  • Diamondbacks outfielder Adam Jones, who left Tuesday’s game with hamstring tightness, got good news from his MRI Wednesday. He’s day-to-day and could be ready to hit when the Diamondbacks take the field next in Toronto on Friday.