PHOENIX -- Facing division-rival Los Angeles for the fourth time in two months, Diamondbacks starter Trevor Cahill reached deep into his bag of tricks.
Cahill got through a rocky first inning before mixing four pitches to retire 20 of his final 22 batters, and the Arizona Diamondbacks beat the slumping Los Angeles Dodgers 3-2 on Wednesday night.
"I felt confident I could throw all four pitches anytime in the count," said Cahill, who has won his past four starts against Los Angeles. "If you only have two pitches working and they know it and I know it, you end up trying to throw too fine a pitch."
The Dodgers, who have lost six of seven, squandered a chance to pull even with the St. Louis Cardinals in the race for the second NL wild-card spot. The Cardinals lost 3-2 to San Diego earlier Wednesday.
The defeat left Los Angeles a game behind St. Louis. The teams begin a four-game series Thursday at Dodger Stadium.
"I'm sure people are getting tired of hearing me say it, but we have to turn the page," Dodgers manager Don Mattingly said. "St. Louis and ourselves, we have let a lot of people back in the race -- but it's still in our hands. No matter how bad it has looked and no matter where it has been, it's still right there for us."
Arizona (71-72) moved within four games of the Cardinals.
"It's getting better," Diamondbacks manager Kirk Gibson said. "We need to keep running in the same direction we're going now, but it's getting interesting."
Cahill (11-11) scattered four hits, struck out seven and did not walk a batter for the second time this season. He also did not issue a free pass June 20 against Seattle.
"He kept it together," Gibson said. "He limited the damage, and that was big."
After that, Luis Cruz's two singles represented all the offense for the Dodgers over the final eight innings.
"It feels good that you're able to score two early," Mattingly said. "But that feeling goes away as you're not able to add on. As the game gets later, you've given the momentum back."
Pitching with a 2-1 lead, Dodgers starter Aaron Harang issued consecutive two-out walks in the sixth. Upton followed with a single to tie the game 2-all and end Harang's night.
Left-hander Randy Choate came on to face the left-handed-hitting Parra, who lined a single to right that gave the Diamondbacks a 3-2 lead.
"You get two guys who are up there that can change a game real quick, so you're not trying to lay a cookie in there," Harang said. "You're trying to give them something to swing at that they're either going to hit softly or hit on the ground somewhere. Then I end up walking those guys."
Harang (9-9) allowed four hits in 5 2/3 innings but walked four.
"As closer, that's who you want to face," Hernandez said. "They're not all going to be three-run saves."
Gonzalez, punched out on a called third strike for his third strikeout of the game, thought it was ball four.
Los Angeles, which dropped seven games behind first-place San Francisco in the NL West, is batting .184 in its past five games with one homer and seven runs.
The Diamondbacks have won 10 of the past 12 meetings between the clubs. Arizona starters are 9-0 with a 1.75 ERA in their past 12 games against the Dodgers.
"Winning one-run games against division rivals, sometimes those are better than blowouts," Cahill said.
The Diamondbacks cut Los Angeles' lead in half in the second when Paul Goldschmidt singled, stole second, went to third on a wild pitch and scored on a sacrifice fly by Upton.
Hernandez last recorded back-to-back saves on July 7-8, 2011. ... Arizona has won consecutive one-run games for the first time since opening the season with three straight one-run victories over the Giants. ... Diamondbacks closer J.J. Putz missed his second straight game with stiffness in his back. ... Harang is 3-8 with a 3.19 ERA in 17 career appearances and 16 starts against Arizona. ... What better way to reduce some pennant-race tension than phantom infield practice? Before the game, the Dodgers pantomimed their way through their infield warm-up, with the fielders scooping imaginary grounders and catchers stumbling in foul territory under invisible, sky-high popups. ... Dodgers RHP Josh Beckett (1-2) starts against St. Louis RHP Lance Lynn (14-7) on Thursday. The Diamondbacks have the day off before rookie LHP Tyler Skaggs (1-1) faces RHP Matt Cain (13-5) to begin a three-game series against San Francisco.
Salvador Perez tests positive for COVID-19, but he's excited to return to the field
Royals catcher Salvador Perez tested positive for the coronavirus, but told reporters he's asymptomatic.
Freeman among four Braves who tested positive for COVID-19
Braves manager Brian Snitker reveals that Freddie Freeman, Will Smith and two other players have tested positive for COVID-19.
Counting reasons the Rays -- yes, the Rays -- will win the World Series
Long season, short season or any length in between, here's why David Schoenfield is picking Tampa Bay to come out on top in 2020.
Attorney seeking settlements in Red Sox sexual abuse cases
An attorney representing 21 men who claimed they were abused by a former Red Sox clubhouse manager who died in 2005 has tried again to open negotiations -- without success.
Judge plays in the Yankees' first intrasquad game
Aaron Judge goes 0-2 with a strikeout after the Yankees' first intrasquad game Monday night.
Yankees' Aaron Judge 'game-ready' but plate timing still lacking
All-Star outfielder Aaron Judge benefited from the 3½ months of pandemic hiatus perhaps as much as anyone in baseball.