SAN FRANCISCO --Jung Ho Kang hit a tiebreaking home run in the eighth inning and the Pittsburgh Pirates beat San Francisco 4-3 on Tuesday night to knock the Giants out of first place in the NL West.
Andrew McCutchen had two hits while Gregory Polanco drove in two runs without a hit to help the Pirates remain one game behind the second NL wild card.
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.
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.
Antonio Bastardo (1-0) retired three batters for his first win since Aug. 7, 2015. Neftali Feliz pitched the eighth and Tony Watson worked the ninth to earn his sixth save.
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. Watson got Ehire Adrianza to pop up to the infield before Angel Pagan grounded to second to end the game.
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.