The hit gave the win to Hong-Chih Kuo (2-1), who held the Cardinals scoreless in the eighth inning. Jonathan Broxton got his 15th save after a shaky ninth inning in which he stranded a runner on third.
Hiroki Kuroda turned in a solid start for Los Angeles, throwing seven scoreless innings. He limited the Cards to four hits, struck out six and issued only one walk.
St. Louis starter Chris Carpenter was also tough, scattering six hits through seven shutout frames.
Trever Miller (0-1) got the loss. He allowed singles to Rafael Furcal and Andre Ethier in the eighth before Kyle McClellan coughed up the ground-rule double to Ramirez.