PHILADELPHIA (AP) -- The slumping Phillies finally produced some offense Thursday night, just not when they needed it most.
Ryan Howard went 3 for 4, and Freddy Galvis and Chase Utley each had a pair of hits and an RBI for Philadelphia. But the Phillies couldn't convert with runners on first and third and nobody out in the ninth inning of a 4-3 loss to the St. Louis Cardinals.
"We had some good chances, we just couldn't cash in on them," manager Charlie Manuel said. "We didn't get the big hit when we got chances. That's the best we've hit in a while."
The Phillies had 13 hits but failed to draw a walk for the fourth consecutive game. Philadelphia, which entered 26th in the majors with 34 walks, is averaging 2.1 per game.
"We had baserunners all night," Manuel said.
Carlos Beltran hit a go-ahead homer to the opposite field in the eighth inning and saved a run with a tough catch in the seventh for the Cardinals.
"He had a great night for us," manager Mike Matheny said. "It's not easy to hit the ball out the other way, but we've had no bigger hit this season."
Adam Wainwright pitched seven solid innings for St. Louis and fill-in closer Edward Mujica escaped the ninth-inning jam. Yadier Molina went 3 for 4 with two RBIs for the Cardinals, who had seven hits one night after getting held to Beltran's seventh-inning double in a 5-0 loss to A.J. Burnett and the Pittsburgh Pirates.
Wainwright (3-1) wasn't quite as sharp as his previous start, when he tossed a four-hitter and matched a career high with 12 strikeouts Saturday in an 8-0 win over Milwaukee. The right-hander gave up three runs and nine hits this time while striking out four and walking none.
"With a lineup like that and a hitter's park, the main purpose was to keep the ball down. For the most part I was able to," Wainwright said.
He hasn't walked a batter in 29 innings to start the season.
"It's a recipe for success," Matheny said.
Beltran broke a 3-all tie with one out in the eighth when he homered to left field off Mike Adams (0-1).
"He's a really good hitter," Adams said. "I stayed away. I made the mistake of staying out there too long and left one up just enough where he could make a pretty good pass at it."
It was Beltran's 12th career homer at hitter-friendly Citizens Bank Park.
"It's a good ballpark to hit in," Beltran said. "Anything can happen if you hit the ball good. I hit it pretty good but I never thought it was going to leave the ballpark."
Besides the homer, Beltran also prevented a run in the previous inning with an excellent catch of Jimmy Rollins' two-out drive to deep right. A retreating Beltran lunged at the last second to snare a ball that was headed for the wall and surely would have scored Domonic Brown from first base with the go-ahead run.
"He made a great play," Wainwright said. "It looked like his arm extended longer than it normally is."
Mujica wriggled out of trouble in the ninth to convert his first save opportunity. Matheny chose Mujica over Mitchell Boggs, who has blown two of his four save chances this season. It appeared Mujica was about to flop, too, but he recovered quickly.
Ben Revere led off the ninth with a single and went to third on Erik Kratz's single to right. Kratz moved up on pinch-hitter Kevin Frandsen's groundout to shortstop, but Revere held at third. Rollins struck out and Galvis grounded out to end it.
"He stepped up when we needed somebody," Matheny said of Mujica. "He came in and made pitches."
Phillies ace Cole Hamels, who had a 10.97 ERA through two starts, had a second consecutive strong outing but remained winless through four starts. He allowed three runs and five hits while striking out eight and walking two in seven innings.
"I felt really good. Everything was working really well," Hamels said. "But mistakes are coming at the wrong time right now. I have to be better than good. In order to win ballgames, you have to be great. I go out there expecting perfection."
The Cardinals opened the scoring with a pair of runs in the fourth. Hamels walked Matt Holliday leading off and Allen Craig followed with a line drive to right field that fell in front of John Mayberry Jr., who slipped while pursuing the ball.