PITTSBURGH (AP) Derek Law had pitched at PNC Park twice as an American Legion player, once throwing a one-hit shutout in a seven-inning game.
The San Francisco Giants rookie reliever was pretty impressive Wednesday night, too, in his first major league appearance in his hometown, working two scoreless innings for the win after starter Jeff Samardzija matched the shortest start of his career.
Buster Posey threw out John Jaso attempting to steal second base to end the game, Joe Panik's two-run double capped a three-run sixth inning, and the Giants rallied from an early five-run deficit to beat the Pittsburgh Pirates 7-6.
''No words can describe what this was like,'' said Law (3-1). ''I was running out there from the bullpen and I heard cheers from left field. It felt like a home game. I wasn't ready for that. I knew I had a lot of people here, but I didn't think I had that many. It seemed like the whole stadium was cheering.
''This is a big thrill, right up there with making my (major league) debut.''
Panik put the Giants ahead after Ramiro Pena made it a one-run game with an RBI double earlier in the inning. NL West-leading San Francisco has won 11 of its last 13 and scored 73 runs in that stretch.
Panik has had the go-ahead RBI in three of the Giants' five wins during the first six games of their road trip.
''He's a tough out and he'll give you a good at-bat, especially in that situation,'' Giants manager Bruce Bochy said. ''You like having him up there.''
Samardzija matched the shortest start of his nine-year career with just three innings and was tagged for six runs and six hits. He also recorded just nine outs on Sept. 15, 2015, while pitching for the Chicago White Sox against Oakland. However, five relievers followed with a combined six scoreless innings.
''It says a lot about this team, both the bullpen and the offense, when you can pitch a crummy game like I did and we were still able to come away with a win,'' Samardzija said. ''It means a lot and I'm going to remember it.''
Santiago Casilla worked around a leadoff single in the ninth for his 15th save, the game ending when Posey caught Jaso attempting to steal after Gregory Polanco struck out - with Andrew McCutchen on deck.
Pena, Denard Span and Brandon Crawford each had two of the Giants' 12 hits. Pena also drove in two runs as San Francisco won back-to-back games at PNC Park for the first time since 2011.
Jared Hughes (0-1) gave up all three sixth-inning runs for the Pirates, who lost for the 17th time in 22 games. They blew a 6-1 lead despite getting home runs from Jaso, Polanco and Jung Ho Kang. Polanco had a three-run shot in the second inning among his three hits.
Pirates starter Francisco Liriano allowed four runs and six hits in five innings after losing his previous four starts.
''I felt a little better tonight, to be honest,'' Liriano said. ''Physically, I feel a lot better. I think that's one step ahead right there, so just keep working and keep making pitches and find a way to not walk as many guys as I'm walking right now. Things aren't going the way we want them to, but we just have to keep battling.''
An RBI single by Crawford in the fourth started the Giants' comeback, and they closed to within two runs at 6-4 an inning later as Posey doubled in a run and Angel Pagan followed with a sacrifice fly.
Jaso led off the first inning with a home run for the second time this season and sixth time in his career to open the scoring. It was his fourth homer overall this season. Later in the inning, Matt Joyce's RBI single made it 2-0.
Pena singled in a run in the top of the second, but Polanco extended the Pirates' lead to 5-1 with his career-high 10th homer, a blast to right field in the bottom of the inning.
Kang's leadoff homer in the third, his 10th, made it 6-1 - but the Pirates didn't score again.
''What a great job by the bullpen,'' Bochy said. ''Just terrific.''
Pirates: LF Starling Marte (left foot discomfort) did not start but pinch hit in the eighth inning and grounded out after leaving Tuesday's 15-4 loss. ... RHP Ryan Vogelsong (facial fractures) threw off the slope of the front of the pitcher's mound for the first time since being hit in the left eye by a pitch May 23. ... Rookie C Elias Diaz (right elbow surgery) is playing catch at 120 feet and remains on course to be activated in mid-July.
SWITCHING OUT PITCHERS
The Pirates recalled LHP Kyle Lobstein from Triple-A Indianapolis and optioned RHP Wilfredo Boscan to the same club. Lobstein pitched one scoreless inning.
The Pirates needed an extra reliever after Boscan pitched just 3 2/3 innings Tuesday night in his first major league start.
Giants: RHP Albert Suarez (2-1, 3.69 ERA) will make his fourth career start and 10th appearance Thursday in the finale of the four-game series.
Pirates: LHP Jon Niese (6-4, 4.74) has lost his last two starts, giving up a combined 12 runs in 10 2/3 innings.