It wasn’t the prettiest game for the Phillies, but in another sense it would be tough to draw up a winning game as textbook as Friday’s 5-4 victory over the St. Louis Cardinals at Citizens Bank Park.

Facing Adam Wainwright, the winningest pitcher in the league for the past two seasons, the Phillies rallied from a three-run deficit with a gritty four-spot in the third inning in which they took advantage of an error and played solid station-to-station ball.

More telling was a gutsy outing from righty starter Kyle Kendrick, who gave up three runs in the first (surprise), but retired the last 13 of 15 he faced before turning it over to the lights-out bullpen trio of Jake Diekman, Ken Giles and Jonathan Papelbon.

The quartet did not allow a baserunner following Matt Carpenter’s one-out single in the fourth, getting 16 of the last 17 hitters for outs.

Indeed, the Phillies beat Wainwright with eight singles, no extra-base hits and after allowing three runs in the top of the first.