SAN FRANCISCO (AP) Pittsburgh Pirates closer Tony Watson didn't think twice when catcher Francisco Cervelli signaled for an intentional walk that would have loaded the bases in the ninth inning.
It was a miscommunication that almost turned into a costly mistake for manager Clint Hurdle's ballclub until pitching coach Ray Serage came charging out of the visitor's dugout to clarify things.
Watson threw ball one to Ehire Adrianza before getting corrected, then retired the final two batters on seven pitches to preserve Pittsburgh's 4-3 victory over the San Francisco Giants on Tuesday night.
''I saw Cervy put the fingers up and threw the first one, then all of a sudden I saw papers flying out of the corner of my eye in the dugout,'' Watson said. ''I stepped off and knew something was up. Ray came out ... and wanted to go right at him.''
Watson's sixth save of the season helped the Pirates to their fifth win in six games and helped keep them one game behind the second NL wild card. It also knocked the Giants out of first place in the NL West.
San Francisco had runners on second and third with one out in the ninth following an error by Pirates shortstop Jordy Mercer and Joe Panik's double.
Cervelli then called for an intentional walk to Adrianza and Watson complied by throwing a pitch well out of the strike zone. After Serage came out to stop the intentional walk, Watson got Adrianza to pop up to the infield before Angel Pagan grounded to second to end the game.
''(Cervelli) saw an infield defense that has a similar sign as an intentional walk,'' Hurdle explained. ''You can't get anybody's attention because the crowd's so loud so we're yelling and screaming at the top of our lungs and nobody's looking at us. Ray sprinted out ... and he was going to tackle somebody to stop the play.''
Jung Ho Kang hit a tiebreaking home run in the eighth inning, Andrew McCutchen had two hits while Gregory Polanco drove in two runs without a hit for Pittsburgh.
Kang homered off reliever Derek Law (4-2) one pitch after McCutchen was thrown out attempting to steal second base. It was Kang's 14th home run this season and third in four games.
''A 1-2 count is tough but I tried to stay on it and I tried to expand the zone,'' Kang said.
Antonio Bastardo (1-0) retired three batters for his first win since Aug. 7, 2015. Neftali Feliz pitched the eighth to set up Watson.
San Francisco dropped one-half game behind the Dodgers in the West. Los Angeles beat Philadelphia earlier in the day.
The Giants, who had led the division since May 10, have the worst record in baseball since the All-Star break at 9-20.
''A lot of baseball left,'' San Francisco manager Bruce Bochy said. ''We created this with our struggles. Now it's up to us to find a way to get on a roll.''
Giants starter Jeff Samardzija, who took a no-decision against the Pirates on June 22, allowed three runs over six innings. He struck out five and walked one.
Pittsburgh starter Jameson Taillon gave up three runs in six innings with five strikeouts and one walk.
TAILLON'S FIRST HIT
Taillon finally got his first major league hit but it didn't come easily after he had to hustle to beat the throw from right fielder Hunter Pence on a play that looked familiar to Pittsburgh fans. Taillon appeared to have a hit against Milwaukee on July 30 when he hit a liner to right but Brewers right fielder Kirk Nieuwenhuis was playing in and made a strong throw to first for the out.
Giants: C Buster Posey was back in the lineup after sitting out two games but doesn't look fully healed from the back soreness that sidelined him. Posey slowly jogged into second base in the first inning after hitting an RBI double into right-center field. ... San Francisco and 41-year-old right-hander Joe Nathan agreed to a minor league contract. Nathan, who has 377 career saves, will report to the Giants Double-A team in Richmond.
Pirates: RHP Ivan Nova (2-0) faces the Giants for the third time in his career Wednesday but the first since being acquired from the Yankees.
Giants: RHP Matt Cain (4-7) pitches the finale for San Francisco. He has a career 3.04 ERA against Pittsburgh.