By MICHAEL WAGAMAN, Associated Press

SAN FRANCISCO (AP) — Gregory Polanco had a homer and four RBIs, Ryan Vogelsong won in his return to AT&T Park and the Pittsburgh Pirates beat the San Francisco Giants 8-5 on Monday night.

Andrew McCutchen added two hits, two RBIs and made a spectacular diving, backhanded catch in the eighth to help Pittsburgh move within one game of idle St. Louis for the second NL wild card.

READ MORE: Teachers Union Takes Legal Action Over Sac City Unified's 'Refusal' To Address Make-Up Days Related To Strike

That was enough for Vogelsong (2-2) to win despite an up-and-down outing.

Vogelsong, who spent parts of seven seasons with the Giants and won two World Series, allowed four runs over 5 2/3 innings. He walked three and struck out one.

READ MORE: Athletics Snap Out Of Offensive Funk To Beat Twins 5-2

An All-Star with San Francisco in 2011, Vogelsong received an extended standing ovation when he took the mound in the first inning and again when he left in the sixth.

Matt Moore (0-2) is still seeking his first victory with San Francisco since being acquired from Tampa Bay.

MORE NEWS: La Stella Homers As Giants Beat Rockies Again, 10-7

Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.