SAN FRANCISCO – Matt Cain's roughest inning in nearly three years began harmlessly enough. A single to left. A walk. A dribbler to the right side of the infield.
By the time it was over the Giants' All-Star right-hander had allowed five runs, all Arizona needed to beat San Francisco 5-2 on Monday night in a matchup of the NL West's top two teams.
It also moved the Diamondbacks within one game of the defending World Series champions in the division race.
"(Cain) had some tough luck that inning," manager Bruce Bochy said. "He had some pitches that could go either way and there were a few balls we couldn't quite get to. They got five runs and that was the difference in the game."
The Giants, who dropped their fourth straight after being swept in Cincinnati over the weekend, have been alone in first place in the West since June 25. Their lead has been trimmed to one game over the Diamondbacks, who have picked up three games in as many days.
San Francisco, which batted .184 batting during its 2-4 trek through Philadelphia and Cincinnati, couldn't do enough on an off night by Cain (9-7).
Cain was tagged for five runs in the sixth inning, the first time he has given up five in an inning since doing so in the bottom of the first on Sept. 11, 2008, at San Diego. The right-hander has only allowed more than five runs once this year.
"We felt like we made some good pitches. We just didn't get a couple of those groundballs to go at guys. That's the way it goes sometimes. They did their job being able to put the ball in play."
The Giants kicked off an important 10-game homestand with another tough loss for their second four-game losing streak of the year. Five games is the team's longest.
Ian Kennedy (13-3) moved into a share of the NL lead for wins with Phillies ace Roy Halladay and Dodgers All-Star Clayton Kershaw.
Cody Ross and Aubrey Huff each hit solo home runs for San Francisco, Ross leading off the first and Huff on an 11-pitch at-bat in the seventh, but Kennedy still has allowed three or fewer runs in seven of his eight career starts against San Francisco.
Kennedy allowed six hits, two runs and walked one. After Ross' homer, he retired 10 straight and 17 of 19 before Carlos Beltran's sixth-inning triple. J.J. Putz pitched the ninth for his 25th save in 29 chances, getting pinch-hitter Aaron Rowand on a game-ending liner to right with two runners on.
Beltran, San Francisco's newly acquired, slugger went 2 for 4 with a triple in his home debut and received a warm standing ovation from the sellout crowd at AT&T Park when he batted in the first inning. Beltran grounded into an inning-ending double play in the eighth with two runners aboard and his team trailing by three. Beltran had gone 2 for 17 in his initial four games since the New York Mets traded him last Thursday. The Giants are 1-4 since Beltran arrived.
"We had a couple chances with the right guy up but we couldn't get a hit with a man on, and they did," Bochy said. "That's what separated us and them tonight."
San Francisco's other newcomer, shortstop Orlando Cabrera, went 1 for 4.
The Diamondbacks have high expectations for a new guy of their own — and first baseman Paul Goldschmidt quickly showed why.
Hours after Arizona announced it had purchased the contract of the promising infielder from Double-A Mobile, he delivered a sharp single to right field in the second inning against Cain in his first major league at-bat.
Goldschmidt, in the lineup at first base and batting seventh, will get the ball as a souvenir, too, after Beltran retrieved it and threw to the infield.
Arizona won for only the third time in the last 13 meetings between the rivals and is 3-7 in this year's series. The D-backs won at AT&T Park for the first time in four tries in 2011.
Bochy is looking for someone to take hold of the leadoff spot, and Ross might be making his case after his first audition. He had two hits with the homer and scored a run. Ross also started in center field in place of the struggling Andres Torres.
NOTES: It was Ross' second career leadoff homer and first since 2008 with Florida. ... The Giants placed struggling LHP Barry Zito on the 15-day disabled list with a recurrence of his earlier right foot sprain that landed him on the DL previously. Zito lost his third straight start Sunday at Cincinnati. San Francisco needed to make room for the return of LHP Jonathan Sanchez, who will start Friday night against the Phillies. ... Giants LHP starter Madison Bumgarner celebrated his 22nd birthday.