SAN FRANCISCO (AP) 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 Blanco 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.

More from FoxSports

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.