LOS ANGELES -- The St. Louis Cardinals got superb relief pitching, a couple of game-saving defensive plays from their outfield, and just enough offense.
Cardinals right-hander Carlos Martinez couldn't make it out of the fifth inning despite the two-run lead. Manager Mike Matheny pulled him after a one-out single by Dee Gordon and a walk to Yasiel Puig, but Seth Maness (3-2) retired Adrian Gonzalez on a double-play grounder.
"Carlos got himself into a little bit of a bind again, and you could tell he was about at that limit," Matheny said. "Seth came in, and even against a tough lefty -- which hasn't been a strength of his -- he made some good pitches on Gonzalez and was able to pull us out of the inning with that double play. Then he got us through the righties in that next inning."
Maness allowed one hit through 2 1/3 innings with two strikeouts.
"It was one of those crazy games, so we were ready for anything and tried to piece it together," Maness said. "It was just good to get back out there, try and force weak contact and get the ball on the ground."
"He was running his heart out," Allen Craig said. "That's a tough play, with the wall creeping up on him. That was kind of a fearless play he made right there, and it came at a great time in the game."
A.J. Ellis, not the fleetest by any means -- and just two weeks off the disabled list after arthroscopic knee surgery -- tried to stretch a single into a double in the fourth. It took a great play by right fielder Craig, who cut the ball off while skidding across the foul line and threw a perfect strike to Peralta.
"Right off the bat, I tried to get over there as fast as I could to cut it off and keep him at second," Craig said. "The ball kind of skipped on me, just because the grass is quick out there. So I had to slide just to get to it, then I just turned and threw it and tried to get it close to the bag."
Matheny was duly impressed by Craig's aggressiveness on the play.
"That's one of the best plays we've ever seen Allen Craig make," he said.
Martinez allowed a run and six hits, struck out four and walked three in his fourth major league start.
Ryu (9-4) gave up three runs and nine hits in seven innings with seven strikeouts and one walk.
Peralta, who struck out his first two times up, snapped a 1-1 tie in the fifth with a two-out drive to the fence in right-center that scored Matt Carpenter and Matt Holliday. That gave the shortstop six RBIs in his last six games.
The Dodgers opened the scoring in the second on Gordon's RBI single. But Molina tied it in the fourth with his seventh homer, lining a 1-0 pitch off the left field pole. Ryu has allowed a home run in four of his last five starts after yielding just two in his first 10 outings.
Martinez got his first big-league hit in the third, a dribbler toward third base that Uribe couldn't handle cleanly on a barehanded attempt. Carpenter followed with a single, but Ryu retired Holliday on a double-play grounder and Matt Adams on another ground ball.
"Overall, it was a really good game for me," Ryu said through a translator. "My control was there, my velocity was there and I managed my pitch count really well. The home run, it was just a good hit ball. It was a changeup, maybe a little bit too close to the middle."
The Dodgers have yet to win more than three straight games. This was their sixth attempt. ... Scott Van Slyke was ejected for the first time in 130 games by second base umpire Chad Fairchild after Molina threw him out trying to steal in the sixth. ... Dodgers starting pitchers have issued fewer than three walks in 31 consecutive games, matching the 1990 Pittsburgh Pirates for the longest such streak by an NL club since 1914. Ryu hasn't walked more than two batters in any of his last 12 outings. ... St. Louis has allowed a major league-low 26 home runs on the road. ... Seven of Molina's last eight homers have been solo shots.