PHILADELPHIA (AP) - The Cardinals used the long ball to rally and small ball to win.
Tommy Pham's second solo homer off Hector Neris in the ninth inning tied it and the St. Louis Cardinals came back from a 5-0 deficit to beat the Philadelphia Phillies 7-6 in 10 innings Wednesday night.
Jedd Gyorko hit a two-run homer and pinch-hitter Jose Martinez also connected for St. Louis.
"Any time you come back like that, it feels real good, shows we have a lot of character," Pham said.
The game went to extra innings after Freddy Galvis lined a double down the left-field line with two outs in the bottom of the ninth, but Odubel Herrera ran through a stop sign, around third-base coach Juan Samuel and was thrown out by 10 feet. He didn't even attempt to slide and was pulled from the game in a double switch.
"I was playing aggressive, I wanted to win the game, I put my head down and kept running," Herrera said through a translator. "I saw (the stop sign) late. It's my mistake."
Phillies manager Pete Mackanin said Herrera let his "emotions get the best of him."
Martinez led off the 10th with a double to right off Edubray Ramos (0-6). He advanced to third on a balk and scored when Ramos made a throwing error on a pickoff attempt at first base after Dexter Fowler was intentionally walked. Yadier Molina added an RBI single.
Phillies starter Nick Pivetta had a career-high 10 strikeouts and allowed three runs and four hits in six innings. The rookie right-hander fanned nine in seven scoreless innings in his previous outing against Boston -- also a no-decision. The Cardinals won their second straight extra-inning game after losing five of six.
The Phillies have lost 13 of 14 and 39 of 50. They have the worst record in the majors (22-48).
Cardinals starter Michael Wacha gave up five runs -- two earned -- and nine hits in four innings. Brett Cecil (1-2) got two outs to earn the win. Seung Hwan Oh allowed a run but finished for his 16th save in 18 tries.
The Phillies jumped ahead 3-0 in the first inning. The runs were unearned because of a fielding error by second baseman Greg Garcia.
After Garcia booted a double-play grounder, Maikel Franco drove in the first run with a fielder's choice grounder and Herrera ripped a two-run double to right-center.
Garcia made a throwing error in the fourth that allowed another run as the Phillies took a 5-0 lead.
Pham hit his eighth homer in the fifth. Gyorko went deep in the sixth for his 11th homer. Martinez hit one off Joaquin Benoit in the eighth to cut it to 5-4. Pham drove one out to straightaway center to tie it in the ninth.
"He's a dangerous hitter to any part of the field," Cardinals manager Mike Matheny said of Pham. "An exciting player."
The Cardinals have hit three or more homers in five consecutive games. They have 19 homers since June 16.
The Phillies have played three straight extra-inning games and 11 this season, going 4-7.
SIGNED AND READY
Outfielder Adam Haseley, selected eighth overall in last week's amateur draft, agreed to a minor league contract with the Phillies that includes a $5.1 million signing bonus.
The 21-year-old, a left-handed hitter, batted .390 with 14 homers and 56 RBIs in 58 games at Virginia this year. Haseley could begin his pro career at Single-A Clearwater.
"Wherever they want me to go," Haseley said. "I'm just looking forward to getting going."
Cardinals: CF Fowler left the game with left quad tightness after scoring from second base on a single for the seventh run.
Cardinals: RHP Carlos Martinez (6-5, 2.86 ERA) starts the series finale Thursday afternoon. He's 3-0 with 20 strikeouts in 23 innings in three starts vs. the Philadelphia.
Phillies: RHP Aaron Nola (3-5, 4.76) goes against the Cardinals. He's 1-1 against them.