Aaron Nola pitched shutout ball into the eighth inning, Freddy Galvis and Tommy Joseph homered, and the Philadelphia Phillies beat the St. Louis Cardinals 5-1 Thursday to stop a five-game losing streak.

Joseph drove in three runs as Philadelphia, a major league-worst 23-48, won for just the second time in 15 games.

Nola (4-5) allowed one run, four hits and two walks in 7 1/3 innings and struck out eight.

Paul DeJong homered on a hanging curveball leading off the eighth, pulling the Cardinals to 3-1, and Matt Carpenter walked with one out. Pat Neshek relieved and got Tommy Pham to ground into an inning-ending double play, and Luis Garcia followed with a perfect ninth.