Updated

San Francisco, CA (SportsNetwork.com) - Neil Walker and Andrew McCutchen each drove in two runs, Gerrit Cole tossed seven solid innings and the Pittsburgh Pirates beat the San Francisco Giants 4-3 on Monday.

Cole (8-2) gave up two unearned runs on five hits while striking out nine and walking two. The right-hander has won his last three starts.

"It was a very impressive performance from start to finish," Pirates manager Clint Hurdle said of Cole.

Brandon Belt knocked in two runs for the Giants, who have lost three in a row since a five-game winning streak. Ryan Vogelsong (4-3), who had won his previous four decisions, allowed four runs -- three earned -- on five hits over six innings.

It was the first meeting between the clubs since the Giants blanked the Pirates 8-0 to win last season's NL Wild Card Game.

The Giants scored two runs in the first. Nori Aoki singled and stole second before Hunter Pence reached on Jung-Ho Kang's throwing error. Both runners crossed the plate on Belt's two-out double to right.

Pittsburgh got one run back in the third. Cole reached on Matt Duffy's throwing error, Josh Harrison walked and Gregory Polanco singled to load the bases with one out. Angel Pagan then made a diving catch in left-center field, robbing McCutchen of a big hit. Cole scored on the sacrifice fly.

"You kind of get used to seeing it," Vogelsong said of Pagan's play.

The Pirates used a three-run fifth to take a 4-2 lead. Cole reached on a fielder's choice, Harrison was hit by a pitch and Polanco walked to load the bases. McCutchen followed with a sacrifice fly and Walker added a two-run double to left-center field.

San Francisco failed to score after loading the bases with no outs in the sixth. Belt struck out swinging and Brandon Crawford grounded into an inning- ending double play.

The Giants scored a run off Tony Watson in the eighth. Aoki doubled to left, moved to third when Joe Panik flied out and scored on Pence's groundout.

Mark Melancon pitched a perfect ninth for his 14th save of the season.

Game Notes

Chris Stewart hit three doubles for the Pirates ... Each team had six hits ... Panik went 2-for-4 and has now hit safely in each of his last 15 games at AT&T Park ... Vogelsong, a former Pirate, fell to 2-4 lifetime against Pittsburgh.