SAN FRANCISCO (AP) Drenched and reeking of the cheap beer his teammates sprayed on him, Jeff Samardzija stood at his locker soaking in a long-awaited win.
''I smell great,'' Samardzija said, smiling. ''I'd rather just drink the beer than them pour it on me.''
Samardzija (1-4) allowed six hits and walked none in seven-plus innings. He also had an RBI double during a three-run fourth to help snap his 16-start winless streak.
The right-hander entered with six no-decisions in his first 10 outings this year despite leading the majors with a 1.46 ERA. Chicago had lost nine of Samardzija's first 10 starts.
''I think it's a relief for him. Everybody's wanted him to have a victory,'' Cubs manager Rick Renteria said.
Pablo Sandoval homered and drove in three runs for the Giants, who had won four in a row. Sandoval has five home runs and 12 RBIs in his last eight games.
Yusmeiro Petit (3-2) gave up four runs and six hits in five innings while filling in for injured starter Matt Cain, who was scratched after exiting his last outing with a strained right hamstring. Petit struck out five and walked none.
Left-hander David Huff, who struck out as a pinch-hitter in the fifth, allowed four runs and seven hits in 1 1-3 innings of relief as the Cubs provided plenty of runs to back Samardzija's long-sought victory.
''He's got gasoline in his arm,'' Giants catcher Hector Sanchez said of Samardzija, whose fastball regularly reached 96 mph on the ballpark's radar.
Samardzija had not won since Aug. 24 at San Diego last season, mostly because of a lack of support from his lowly club. He has allowed more than two runs only twice this year, including Monday.
''Guys played amazingly out there for me today, and I know they've been wanting it as much as I did,'' Samardzija said.
Samardzija was pulled after Angel Pagan singled leading off the eighth. It was the sixth time in Samardzija's career he had at least 10 strikeouts.
That Samardzija's skid ended at San Francisco - which entered with the best record in the majors - only made it that much sweeter.
The Giants' hottest hitter capitalized on two of the few mistakes Samardzija made. After Pagan reached when Samardzija dropped the ball for an error while covering first base, Sandoval singled with two outs in the first to give the Giants a 1-0 lead.
The Cubs came back in the third on solo shot by Schierholtz, a former Giants outfielder. Sandoval put San Francisco up 3-1 with a golf-like swing on a pitch that looked well below the strike zone in the fourth.
Samardzija hit a tying, two-out double and scored on Emilio Bonifacio's triple during a three-run fifth that put the Cubs in front 4-3.
''The hit by their pitcher kind of broke our back,'' Giants manager Bruce Bochy said.
''He deserves to have a lot of wins right now,'' Schierholtz said, ''and it was just nice to get him that one today.''
NOTES: The Cubs activated OF Justin Ruggiano from the 15-day disabled list and optioned OF Ryan Kalish to Triple-A Iowa. ... Bochy said he used Huff as a pinch-hitter in the fifth because he was worried that Sanchez (foul tip off mask) and LF Michael Morse (left calf tightness) might need to come out of the game in the late innings. ... Cain is progressing well and the team hopes the right-hander will take his next turn in the rotation Saturday at St. Louis. ... Tim Hudson (4-2, 2.13 ERA) takes the mound for the Giants opposite Chicago's Jake Arrieta (1-0, 2.33) on Tuesday.