SAN FRANCISCO (AP) - Joe Musgrove pitched five shutout innings and hit a triple, Jacob Stallings homered and the Pittsburgh Pirates defeated the San Francisco Giants 4-2 on Thursday.
The Pirates took three of four in the series, and have won 14 of their last 20 games in San Francisco dating to 2014.
Evan Longoria homered for the Giants, who've lost four of five. San Francisco has dropped nine of its last 11 home games and is 31-41 at Oracle Park this season.
Musgrove (10-12) struck out seven, gave up four hits and walked none.
Pirates closer Felipe Vázquez worked around a first-and-third, no-outs situation in the ninth for his 28th save in 31 attempts.
Joey Rickard drew a leadoff walk to start the ninth and Donovan Solano followed with a single, but Vázquez struck out Corban Joseph and Mike Yastrzemski, and then got Buster Posey to ground out.
José Osuna doubled in a run in the top of the first, and Cole Tucker tripled and scored on Kevin Kramer's sacrifice fly to give Pittsburgh a 2-0 lead in the fourth.
Musgrove tripled leading off the fifth and scored on Adam Frazier's single to make it 3-0.
Longoria hit a two-run homer off reliever Yacksel Ríos - his 19th - in the Giants sixth.
Stallings hit his sixth homer and second of the series leading off the seventh against starter Jeff Samardzija (10-12).
Musgrove's triple was the first by a Pirates pitcher since May 29, 2010, when Brian Burres did it.
Pirates: CF Starling Marte was out of the lineup for a fourth straight game with a left wrist sprain he suffered making sliding catch on Sunday against St. Louis.
Giants: Manager Bruce Bochy moved up RHP Johnny Cueto's next scheduled start two days to Sunday, the finale of a three-game series against Miami. The two-time All-Star, who pitched five shutout innings in his first game back from Tommy John surgery on Tuesday, had been scheduled to make his next start on Sept. 17 in Boston. . LHP Will Smith (back inflammation) will play catch on Friday. Bochy said his All-Star closer could be back on the mound as soon as this weekend. . OF Alex Dickerson (right oblique injury) took 40 swings on Wednesday and planned to do the same on Thursday. He'll hit against a machine on Friday and could pinch hit over the weekend, Bochy said. . OF Jaylin Davis left the game for a pinch runner after being struck by a pitch in from Ríos in the sixth.
Pirates: LHP Steven Brault (4-4, 4.13 ERA) will face Cubs left-hander Jon Lester on Friday in Chicago. Brault is 0-1 with a 6.31 ERA in 13 career appearances (four starts) against the Cubs.
Giants: RHP Tyler Beede (4-9, 5-33) will pitch Friday's series open against Miami. Beede ended a streak of nine winless starts in his most recent outing on Sept. 7, when he pitched five innings of four-hit ball in a 1-0 victory over the Dodgers.