PHOENIX -- Paul Goldschmidt rarely has been so happy making so little contact.
"It would have been a strike but I was out front of it," Goldschmidt said. "It fooled me, so I was really lucky it found a hole. When I saw it, I thought it had a chance."
Diamondbacks starter Trevor Cahill pitched six-hit ball for 7 1/3 innings and three relievers got the final five outs for Arizona, which shut out Los Angeles twice in taking two of three.
Beckett (0-2) retired Martin Prado on a grounder to short to start the ninth. A.J. Pollock followed with a double to center field. Beckett ran the count to 3-0 before walking Miguel Montero intentionally. Goldschmidt then singled to right past a diving Mark Ellis at second.
"It hit just right in the spot," said Diamondbacks manager Kirk Gibson. "Those hurt but it felt good for us."
J.J. Putz (1-0) walked one in the ninth.
Beckett, who had struggled at Chase Field throughout his career, allowed six hits and struck out nine over 8 1/3 innings, his longest outing since a complete-game shutout on June 15, 2011, for Boston against Tampa Bay.
"If a guy is throwing the ball well through eight innings and hasn't given up a run, I don't care who it is, they earned the right to go back out there," said Beckett, who walked one and threw 72 of 102 pitches for strikes.
Beckett entered with a 1-2 record and 5.16 ERA across 22 2/3 innings in Phoenix.
"It was a no brainer," said Mattingly, who didn't warm up a reliever until Pollock reached base. "It wasn't even hard. There was no question. It was his game. That was electric today."
Cahill struck out four without walking a batter, the first time he's pitched without a walk since Sept. 12, a 3-2 win over the Dodgers.
"Sometimes it (a close game) is nice because you get into a kind of a rhythm," Cahill said. "In the dugout I get antsy. I want us to score runs but sometimes I really want to go back out there. It's fun. You always want to face someone who's throwing well so you can see if you can beat them."
The Dodgers' best scoring chances against Cahill came in the seventh and eighth innings.
Adrian Gonzalez doubled off the center field wall -- his third straight hit and sixth in his past seven plate appearances -- leading off the seventh, Los Angeles' first player to reach second base.
In the eighth, Punto singled and was bunted to second by Beckett. Cahill gave way to Sipp, who retired Carl Crawford on a grounder to first, and Ziegler, who forced Mark Ellis into a grounder to third to keep the game scoreless.
Arizona fared little better against Beckett, who allowed only Cliff Pennington to advance to third base over the first eight innings. He reached third twice. Pennington singled in the third and doubled in the fifth.
"He was in complete control of his pitches, his tempo, his emotion," A.J. Ellis said. "After a while I just got out of the way and let him call his own game."
Gonzalez finished 3 for 4, the ninth time in his career he has at least three hits in consecutive games. ... Dodgers CF Matt Kemp finished 0 for 4 with three strikeouts to drop his batting average to .174. Kemp has struck out 14 times in 45 at-bats. ... Diamondbacks 2B Aaron Hill left the game in the bottom of the fourth after aggravating his sore left hand. Hill was making his first start since he was hit on the left hand Tuesday against Pittsburgh. He drove in a run as a pinch-hitter Saturday and was 0 for 1 against Beckett before he was replaced by Pollock. ... Cahill needed only 93 pitches to get his 22 outs. ... Prado started the game in left before moving to second base to replace Hill. ... Los Angeles RHP Chad Billingsley, who scattered five hits and allowed one run in six innings against San Diego on Wednesday, faces LHP Eric Stults and the Padres on Monday. ... Arizona RHP Brandon McCarthy brings a 2-0 record against New York into Tuesday's start against the Yankees at Yankee Stadium. McCarthy, who is 1-0 in two starts in New York, will face RHP Ivan Nova.