''Tonight's the night it turns,'' Roberts predicted before the game, with his club five games under .500.
The defending NL champions stopped a four-game losing streak and won after eight consecutive regular-season losses at Chase Field, home to the top team in the National League. But a much-needed victory came with more adversity, as starting pitcher Hyun-Jin Ryu was injured early.
A youngster and a struggling bullpen picked up Ryu, as Alex Verdugo doubled and scored twice, and the Dodgers' relief corps came through.
Verdugo, a 21-year-old outfielder from Tucson, scored a key insurance run in the eighth inning. He doubled off reliever T.J. McFarland, beat the throw to third on a wild pitch and came home on Yasmani Grandal's sacrifice fly for a 2-0 lead.
''I was just looking for any ball in the dirt to do exactly what I did,'' Verdugo said. ''Get me on third base for Grandal with one out, and most of the time he comes through for us, so it was a big at-bat on him.''
In the first, Verdugo doubled with one out and scored on Cody Bellinger's single off Zack Godley (4-2), who allowed five hits in six effective innings.
Three of the five Dodgers relievers had allowed at least a run in their previous outing, but all five combined to limit the Diamondbacks for 7 2/3 innings, including Kenley Jansen's fourth save in six chances.
''They got the MVP for the night,'' Roberts said about his bullpen. ''They've taken a lot of criticism and obviously they haven't performed. We had no margin for error essentially. ... Each one of those guys stepped up.''
The injury-depleted Dodgers led 1-0 when Ryu, their most successful starter this season at 3-0 with a 2.12 ERA, exited with a left groin strain.
Ryu had two strikeouts and a hit and a walk allowed in 1 1/3 innings.
Pedro Baez relieved first and held the Diamondbacks scoreless for 2 2/3 innings, tying a career high for his longest outing. He worked out of a one-out, bases-loaded jam in the fourth.
Ex-Diamondback Daniel Hudson (1-0) tossed two innings and Tony Cingrani one. Josh Fields escaped a one-out, two-on situation in the eighth by inducing a double-play grounder from hot-hitting A.J. Pollock.
The Dodgers squandered opportunities themselves, grounding into three double plays.
Arizona rallied in the ninth against Jansen, who walked Daniel Descalso with two outs. Descalso scored on John Ryan Murphy's soft single.
With pinch-runner Jarrod Dyson at second, Jansen got pinch-hitter Alex Avila to fly out, ending the game.
''We built some innings but unfortunately we couldn't drive in some runs,'' Diamondbacks manager Torey Lovullo said. ''Hitting with men in scoring position is a very challenging situation in baseball and we just unfortunately didn't do it.''
Dodgers utility man Enrique Hernandez started the double play in the eighth when he backhanded Pollock's hard-hit ball that looked bound for left field and a run batted in.
''It's play of the year up to this point, for me,'' Roberts said.
''You need to knock it down. You need to keep it in front of you,'' Hernandez said. ''I was able to stay down and make a play.''
Pollock was chosen National League player of the month for April. He had nine homers, 19 extra-base hits, 24 RBIs and an OPS of 1.021 in March and April.
''It was a great piece of recognition that he got and deserved,'' Lovullo said. ''The first thing that came out of his mouth was, `It's great, but we're winning games and that's the most important thing.'''
Dodgers: RHP Tom Koehler, on the 60-day disabled list with a shoulder injury, is throwing from 75 feet. ... OF Yasiel Puig (left hip bruise) could be back by May 8. ... INF Logan Forsythe (shoulder soreness) played at nearby Camelback Ranch, the Dodgers' spring home. He told Roberts he hopes to be ready for a rehab assignment this weekend. ... LHP Rich Hill (finger) could rejoin the rotation Sunday against San Diego in Mexico, Roberts said.
Diamondbacks: OF Steven Souza Jr. (pectoral strain) had two at-bats and played five innings in extended spring training. He threw from 150 feet and told Lovullo he felt ''fantastic.'' ... RHP Randall Delgado felt shoulder stiffness and had an injection Tuesday. He is on the disabled list with an oblique injury.
Dodgers: LHP Alex Wood looks for his first win of the season Thursday afternoon in the series finale. Wood (0-3) has a 5-4 career record against Arizona.
Diamondbacks: LHP Patrick Corbin (4-0) struck out a career-high 12 against the Dodgers on April 4.
More AP baseball: https://apnews.com/tag/MLBbaseball
Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.