Updated

Andrew McCutchen's solo homer in the bottom of the 12th inning lifted the Pittsburgh Pirates to a 4-3 win over the Milwaukee Brewers in the second test of a four-game set from PNC Park.

The Pirates spoiled two late opportunities and were a whopping 0-for-15 with runners in scoring position for the game. but were still able to prevail thanks to McCutchen.

He led off the final frame, and his blast off Mike Fiers (0-2) just cleared the center field wall, giving Pittsburgh its fourth win in five games.

"I didn't know if it was going to go out or not when I hit it, so I just started running. Once I saw it was a home run, I just kept running," McCutchen said of the homer.

Vin Mazzaro (2-0) picked up the win by spinning the final two of six scoreless frames for the Pittsburgh bullpen. Starter Jeff Locke struck out six over six innings of work, yielding three runs on seven hits -- the most he's allowed in six starts.

Russell Martin had two doubles and an RBI, while Clint Barmes and Garrett Jones drove in a run apiece in the victory.

Milwaukee fell to 1-4 on its 10-game road trip. Jean Segura hit a solo homer and knocked in two runs while Carlos Gomez contributed a pair of hits and an RBI in the setback.

Kyle Lohse worked around five walks to toss 5 2/3 innings of two-run ball for Milwaukee. He left in line for the win, but Milwaukee's fourth reliever of the game, John Axford, blew the save chance.

"It's tough to lose when you have a lead late and can't hold onto it," Brewers manager Ron Roenicke said.

Axford was called upon in the eighth to try and protect Milwaukee's 3-2 lead, but couldn't get the job done. He gave up a leadoff single to Neil Walker, and after Pedro Alvarez struck out, Martin ripped a double down the left field line.

Walker rounded third as Ryan Braun fired it into the cutoff man, but the relay throw to the plate was way off the mark and Walker scored easily to knot the score at 3-3.

Pittsburgh looked to win it in the bottom of the ninth when Tabata ripped a one-out double into the right center field gap, but Milwaukee reliever Alfredo Figaro intentionally walked McCutchen to set up a double play opportunity, which he got on Jones' ground ball.

Each team stranded a runner on second in the 10th before McCutchen struck with the game-winning homer in the 12th.

Segura lifted a solo homer to left in the first inning to give Lohse some early support, but he gave the run right back in the bottom half.

Singles by Starling Marte and Tabata preceded a flyout from McCutchen, which sent Marte to third. Jones then grounded out to second to push a run home and tie the score at 1-1.

Milwaukee jumped back in front in the fourth thanks to a pair of doubles. Braun led off the frame by grounding one past third baseman Alvarez and came home on Gomez' shot off the wall in right.

Locke got a bit wild after Norchika Aoki hit a sharp grounder off the pitcher's foot. He threw two pitches past his catcher, allowing Aoki to move to second and then third. Milwaukee held a 3-1 edge on Segura's groundout to second.

After Tabata's double to lead off the third, the Pirates didn't manage another hit off Lohse until the sixth, when Martin was able to drive a double into center with a man on to put runners on second and third. The Pirates then pulled within a run, 3-2, on Barmes' groundout to short.

Game Notes

The Brewers used seven relievers in all ... Aoki and Braun each had three hits for Milwaukee. Braun sat out Monday's contest to rest a sore neck ... The Brewers saw their five-game winning streak at PNC Park come to an end ... Milwaukee was 1-for-9 with RISP.