The Cardinals have won two in a row and seven of 10. Philadelphia has lost two straight after a season-high five-game winning streak.
Ellis broke a 3-all tie with a safely squeeze bunt in the fourth. He added an RBI single in the sixth. He is hitting .193 with 12 RBIs in 41 games.
Carlos Martinez (1-3) allowed three runs over five innings.
Martinez, who has 31 relief appearances, was making his second start, replacing Michael Wacha for just one turn in the rotation.
Kyle Kendrick (3-7) allowed five runs and eight hits in six innings.
NOTES: Cardinals manager Mike Matheny had the No. 57 written on his left arm to honor former St. Louis pitcher Darryl Kile, who died 12 years ago Sunday. ... The Phillies begin an eight-game homestand Monday with the first of four games against Miami. Roberto Hernandez (3-5, 4.52) will face Nathan Eovaldi (4-3, 3.76) in the opener. ... St. Louis starts a 10-game road trip Monday with the first of three games in Colorado. Lance Lynn (7-5, 3.15) will take on Jhoulys Chacin (2-2, 4.65). ... The previous three St. Louis games prior to Sunday lasted exactly 2 hours and 48 minutes. This one took 2:54. ... St. Louis OF Matt Holliday hit in the No. 2 spot in the batting order for the first time this season. The Cardinals have used 11 different players in that slot this season.
Link to box score: St. Louis (41-35) 5, Philadelphia (34-40) 3
Join the pre-game, in-game and post-game discussion about each contest at The Cardinal Nation message board.