LOS ANGELES -- Trailing 4-1 in the ninth, the Los Angeles Dodgers found a way to win again. They didn't even need extra innings, either.
Chris Taylor singled in the winning run in a four-run ninth, helping the NL West leaders rally for a 5-4 victory over the second-place Arizona Diamondbacks on Thursday night to complete a three-game sweep.
It was the Dodgers' 22nd comeback win of the season.
"It's kind of been our bread and butter this year; it feels like we're never out of the game," Taylor said. "We've had I don't even know how many comebacks in the ninth where it seems like we're out of it. We just put one good at-bat together and get some guys on and things start happening."
Taylor's bases-loaded single off T.J. McFarland eluded the desperate stab of left fielder Ray Fuentes and scored Logan Forsythe. It was one of Taylor's career-high four hits, including two doubles.
"That was incredible," Dodgers starter Rich Hill said. "I saw some people leaving the ballpark. You've got to stay!"
Los Angeles increased its division lead to 5 games over the D-backs.
"For us to look back on this series and win three is obviously a big boost," manager Dave Roberts said.
Josh Fields (4-0) got the win after a run-scoring balk in the top of the ninth.
Fernando Rodney (3-3) took the loss, having given up a bases-loaded walk to Forsythe that left the Dodgers trailing 4-2 with no outs.
Jake Lamb homered twice for Arizona, including a go-ahead solo shot in the eighth. The D-backs were swept for the first time this season and have lost six of eight since June 28.
"It was a great series sweep against a great team," Taylor said. "Our pitch throwing was unbelievable this series and then some really tough pitching we faced as well. We did a good job battling, grinding, coming up with some clutch hits, clutch at-bats, especially at the end of the game."
Rodney entered with a 4-1 lead in the ninth, but he couldn't find the strike zone. Yasiel Puig hit a leadoff single before Rodney issued consecutive walks to pinch-hitters Joc Pederson and Cody Bellinger and Forsythe that loaded the bases.
Corey Seager singled to center, driving in Pederson and Bellinger to tie the game at 4. After intentionally walking Justin Turner, Rodney yielded to McFarland, who gave up Taylor's first career walk-off hit. Turner doused Taylor with a cooler of water on the field in celebration.
"They're a resilient team, just like we are," Arizona All-Star pitcher Robbie Ray said. "They won the series, but we're not going to lay down."
Ray tied his career high with 13 strikeouts while allowing one run and five hits in six innings with four walks.
After Hill left in the seventh with the game tied at 1, the D-backs jumped on the Dodgers' bullpen.
Luis Avilan served up Lamb's second homer leading off the eighth and another to pinch-hitter Ketel Marte, putting Arizona ahead 3-1. Brandon Morrow followed and gave up singles to A.J. Pollock and Paul Goldschmidt before striking out Chris Owings to end the inning.
Chris Iannetta doubled leading off the ninth and scored on Fields' balk, extending the D-backs' lead to 4-1.
Having recovered from blisters that bothered him, Hill gave up one run and two hits. He struck out nine with no walks.
Hill couldn't quite match fellow lefties Clayton Kershaw and Alex Wood, who each threw seven shutout innings in the Dodgers' pair of one-run victories in the series.
Forsythe homered with two outs in the fifth for a 1-1 tie.
Arizona led 1-0 in the fifth when Lamb sent an 0-2 pitch into the lower right field seats for his 19th homer.
Roberts' 12-year-old daughter, Emme, sang the national anthem on her father's bobblehead night. As she finished, Roberts raised both his arms in approval before they shared a hug. His teenage son, Cole, threw out the first pitch, tossing a strike down the middle to Roberts, who served as catcher. They embraced as the crowd cheered. The kids teamed up to shout, "It's time for Dodger baseball!" before the game with mom Tricia looking on.
Diamondbacks: RHP Rubby De La Rosa went on the 10-day DL with right shoulder inflammation.
Dodgers: LH reliever Grant Dayton went on the DL with neck stiffness. He is 1-1 with a 3.63 ERA in 27 relief appearances this season.
Diamondbacks: RHP Zack Greinke (10-4, 3.05 ERA) starts as Arizona returns home for a three-game series against Cincinnati before the All-Star break. He is 8-0 with a 2.67 ERA in 10 home starts this season.