CLEARWATER, Fla. (AP) — Philadelphia left-hander Cole Hamels allowed Jordy Mercer’s two-run home run in the third inning and the Phillies rallied in the sixth to beat the Pittsburgh Pirates 3-2 on Wednesday.

Making his second start of the spring, Hamels struggled with command throughout his three-inning outing. After allowing a two-out walk to Francisco Cervelli, Hamels went to a full count against Mercer before the Pittsburgh shortstop turned on a fastball and sent it over the wall in left.

“That’s spring training. I know I’m not here (trying) to make the team,” Hamels said. “I think for what I’ve done in the past, I have a pretty good spot.”

Hamels allowed two runs on two hits in three innings. He struck out one and walked two.

“Cole had some long counts uncharacteristic of him,” Philadelphia manager Ryne Sandberg said. “But he’s throwing the ball really well. He basically got his work in. He’s fine.”

It was the first hit of the spring for Mercer.

Philadelphia overcame a 2-1 deficit in the sixth. Ben Revere led off with a single, and Cesar Hernandez doubled. Grady Sizemore had an RBI groundout and Jeff Francoeur singled in the go-ahead run.

“It’s nice to win a game,” Sandberg said. “We had good pitching all the way up the line. We did some things with guys in scoring position to manufacture three runs.”

Closer Jonathan Papelbon was the first of five pitchers out of the pen to shut down the Pirates. Andy Oliver (two innings), Elvis Araujo, Mario Hollands and Jeanmar Gomez also pitched scoreless frames in relief of Hamels.

(© Copyright 2015 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)