Neil Walker and Pedro Alvarez hit two-run homers to back Gerrit Cole's solid outing and Pittsburgh beat the San Diego Padres 4-1 on Tuesday night.
The Piartes have won the first two games of this three-game series after three of four in Los Angeles. The trip in New York, where the Pirates lost two of three to the Mets.
"We didn't play our best ball in New York and we had to move on from there," Pirates manager Clint Hurdle said. "We got some traction, got some starts we needed and the bullpen is working very efficiently and the offense continues to show up."
Cole (6-3) limited the Padres to one run and four hits while striking out six in 5 2-3 innings as the Pirates went to 6-1 in his last seven starts. Pittsburgh won its third straight game and 10th in its last 14.
Jason Grilli pitched a scoreless ninth inning for his ninth save.
Jesse Hahn (0-1) lasted 2 2-3 innings in his major league debut for San Diego. He allowed four runs on six hits, including the homers by Alvarez and Walker, striking out five with two walks.
"It was just good to be out there," Hahn said. "It's what I worked for and it's good to get the first one out of the way."
The Padres lost for the third consecutive time and sunk a season-high seven games under .500.
Cole breezed through the first five innings with only two Padres reaching scoring position. But with two outs in the sixth inning, consecutive singles by Chase Headley, Seth Smith and Yonder Alonso ended Cole's night, with Alonso driving in Headley to pull the Padres to within 4-1.
Jared Hughes relieved Cole and got Jedd Gyorko on a grounder to second to end the rally.
"I had good stuff tonight and stuck around long enough to win but I wasn't very effective at all with a four-run lead," Cole said. "That was pretty frustrating and I uncharacteristically ran out of stuff at the end."
He retired 10 straight at one point and only two Padres get into scoring position over the first five innings.
Alvarez doubled the Pirates' lead to 4-0 in the fourth inning, hitting a fastball over the right-field fence for a two-run homer. Alvarez's 11th home run on the year scored Russell Martin, after he opened the inning with a walk.
Hahn gave up two more hits, to Jordy Mercer -- his sixth in seven at-bats -- and Josh Harrison, before being lifted for Jason Lane.
Walker became the eighth different Pirates player to hit their last eight home runs when he connected in the third inning for his 11th of the season. Walker's two-run, opposite-field blast to left came off Hahn's curveball.
"It was easier the second time around to see what he wanted to do," Walker said
Once Hahn exited, Lane worked 3 1-3 perfect innings in his first major league appearance since Oct. 1, 2007, and first as a pitcher. Lane switched to pitching after 497 games as an outfielder.
"Jason did a great job," Padres manager Bud Black said. "Just what we needed."
With Hahn and Lane making their major league debuts as pitchers, it was first time since Sept. 4, 1971 that two Padres did that on the same day.
NOTES: Padres RHP Andrew Cashner could start as soon as Saturday against the Nationals. Cashner will test his mending elbow in a Wednesday side session before getting the OK for Saturday. . LHP Eric Stults was placed on bereavement leave after the death of his grandmother. He isn't expected to miss a start. . OF Carlos Quentin was out of the lineup but is expected to start on Wednesday; he struck out as a pinch hitter in the eighth. . Pirates OF Starling Marte, hitless in his previous 17 at-bats, didn't start. "It's been hard sledding for him," Manager Clint Hurdle said. Marte struck out as a pinch hitter in the seventh. ... RHP Stolmy Pimentel (sore right shoulder) will pitch three innings for Class A Bradenton on Friday. ... Padres RHP Ian Kennedy (4-6, 3.42) faces Pirates LHP Francisco Liriano (1-5, 4.62) in Wednesday's finale of the three-game series.