SAN FRANCISCO -- Trevor Cahill did not feel particularly good in the bullpen before the game. Once he got on the mound, though, everything started to click.
Cahill didn't give up a hit until Marco Scutaro's leadoff single in the seventh. He allowed another single and loaded the bases on a walk before being lifted after 6 1/3 innings.
"Usually pitchers joke: When you feel bad in the bullpen, you feel good in the game," Cahill said. "I felt good early on and I just tried to throw strikes, and the defense was good behind me, so I tried to let them put it in play."
Cahill (10-11) retired the first 16 batters he faced in earning his 50th career win. He allowed two runs, walked two and struck out five in the Diamondbacks' second straight win over the NL West leaders.
"Sometimes I get too rushed," Cahill said. "It's one of those things where I want to work quick, and you can work too quick where you lose your thoughts out there."
Chris Johnson doubled, tripled and drove in two runs for Arizona.
Pablo Sandoval took exception with John McDonald, who came into third base without sliding in the eighth on a force play. Diamondbacks coach and former Giant Matt Williams stepped in immediately as both benches cleared.
"I was trying to slide into third, but he caught the ball in front of the bag and kind of took the slide away," McDonald said. "I tried to go around him and I didn't make it. I kind of went from sliding feet first to try to dive around him. I tripped and fell into him. There's not any more to it than that."
Sandoval said he realized later it was nothing intentional.
"At the moment in the game, you don't really think about it," he said. "He was trying to get to third base. No big deal."
Madison Bumgarner (14-10) lost his third straight start after giving up four runs on seven hits over 6 1/3 innings. He walked two and struck out five.
Brandon Belt drove in two runs for the Giants, who have lost three of their past four games to the Diamondbacks.
Adam Eaton, who had two hits for the second straight night, made two nice running catches in the sixth to keep the no-hitter going. He robbed Xavier Nady on a ball he ran back on and then robbed Angel Pagan with a diving catch coming in.
Nady later left the game with a strained left hamstring.
Cahill lost his bid for a perfect game when he walked Brandon Crawford with one out in the sixth.
"He was hitting the corners and mixing it up," Giants manager Bruce Bochy said. "His ball moves a lot and we couldn't do much with him."
Johnson also made a superb play on a ball that was deflected by Cahill in the second, nailing Belt at first.
Montero's single in the first gave the Diamondbacks a 1-0 lead. McDonald singled home a run in the fourth.
The Diamondbacks tacked on four runs in the seventh, with Johnson's two-run single against Juan Machi the big hit. Hill doubled home a run and Goldschmidt singled in a run.
Giants RHP Clay Hensley (right groin strain) threw to hitters and should be available when he's eligible to come off the DL on Tuesday. Giants OF Justin Christian (left wrist sprain) will also be activated when he's eligible on Friday. Crawford committed his first error since July 28. RHP Tim Lincecum (8-14, 5.21 ERA) will start for the Giants on Friday night. He is 2-1 with a 2.55 ERA against the Dodgers this season. Arizona LHP Tyler Skaggs (1-0, 2.70) will make his second major league start Friday against the Padres. He's the second-youngest pitcher to make his first big league start in a Diamondbacks uniform. The Giants used 24 pitchers in the series. Cahill threw 67 pitches through six innings.