The Dodgers continued their second-half surge by winning for the 11th time in 13 games.
Ryu (11-3) gave up five hits without a walk. The only St. Louis run came courtesy of a throwing error by center fielder Andre Ethier in the fourth inning.
That miscue allowed St. Louis to tie the game, but A.J. Ellis put the Dodgers back in front in the fifth with a three-run homer. Ellis scored the final run in the eighth on a single by Jerry Hairston.
Carlos Martinez (0-1), who had appeared in relief 10 times during his rookie season, started his first major league game and took the loss. He allowed four runs on seven hits in 4 2/3 innings before developing muscle cramps in his right hand.
Kate Middleton recycles dress at movie premiere
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'