Updated

Jose Tabata's three-run double capped a seven-run fifth inning, as the Pittsburgh Pirates pounded the San Francisco Giants, 10-5, to remain atop the NL Central.

With St. Louis winning at home over Atlanta earlier Thursday, the Pirates needed a victory to keep the lead in the division. Pedro Alvarez hit a two-run ground-rule double to start the big frame, and Pittsburgh kept its one-game edge on the Cardinals.

Garrett Jones and Jordy Mercer belted solo homers off Matt Cain, who left with a contusion on his right forearm after he was hit by a line drive in the fourth inning.

Jeff Locke threw 73 pitches over the first four innings and was replaced by Jeanmar Gomez (3-0), who breezed through the ensuing three hitless innings in the opener of this four-game series.

"He maintained rhythm warming up. He maintained that posture," Pirates manager Clint Hurdle said of his decision to replace Locke with Gomez after the long seven-run top of the inning.

Marco Scutaro and pinch-hitter Brandon Crawford had two-run hits for the Giants, who lost for the fourth time in five games. Brett Pill had three of San Francisco's eight hits.

Cain entered the contest having tossed 15 2/3 consecutive scoreless innings against the Pirates. He was 3-0 with a 1.24 ERA in his last six starts against them, but allowed an RBI single to Andrew McCutchen in the opening inning and the homers to Jones and Mercer in the second. Jones' blast landed in San Francisco Bay, as he snapped an 0-for-19 slump.

Cain gave up seven hits over his 3 1/3 innings and was forced out of the game when Gaby Sanchez laced a ball that glanced off the pitcher as he tried to protect himself. Cain walked off the field and was replaced by Guillermo Moscoso (1-2).

"He took a pretty good shot there. He's going to be sore for a while," said Giants manager Bruce Bochy, who noted there's a chance Cain could miss his next start.

X-rays taken were negative.

"We are fortunate and he is. He's tough," added Bochy. "Once we got out there, you could see it starting to swell up."

Buster Posey's sacrifice fly in the third plated Scutaro, who singled to center the next inning to tie the game.

The Pirates sent 11 men to the plate in the fifth. A wild Moscoso walked two batters and hit Tabata to start the bottom half. Jose Mijares then gave up Alvarez's two-run hit. Russell Martin and Sanchez tacked on sacrifice flies. Locke's single kept the inning going, and Tabata then cleared the bases with his smash to left.

Crawford hit a two-run ground-rule double to center in the eighth inning. Tony Watson then struck out Nick Noonan with two men in scoring position.

Game Notes

The Pirates, who have won three of their last four games, recorded their 9,800th win in franchise history since joining the National League in 1887. They are the sixth major league team to reach the mark, joining the Giants, Cubs, Braves, Dodgers and Yankees ... McCutchen has hit safely in each of his last nine games against the Giants at a .459 (17-for-37) clip ... Alvarez has nine RBI in his last seven games ... The Giants placed outfielder Andres Torres on the 15-day disabled list with a strained left Achilles tendon. The team also optioned pitcher Michael Kickham to Triple-A Fresno, while recalling infielder Nick Noonan and outfielder Francisco Peguero from Fresno ... Giants third baseman Pablo Sandoval, who was been held out of the lineup the last two games due to a sore back, started and went 1-for-3 with two runs scored.