Trailing 5-3 entering the seventh, the Dodgers got a one-out single from Elian Herrera off the Cardinals' Victor Marte. Marc Rzepczynski (0-2) came in to pitch and allowed a single to Bobby Abreu before fanning Andre Ethier.
That brought up pinch-hitter Van Slyke, playing in his eighth major-league game. He blasted a 3-0 pitch into the left-field stands to put the Dodgers up 6-5 and LA hung on to complete the a three-game sweep.
Ethier went 2-for-4 with an RBI while Herrera and Abreu each had three hits for National League West-leading Los Angeles, which improved to an MLB-best 28-13.
Javy Guerra (2-3) earned the victory and Kenley Jansen nailed down his fifth save for the Dodgers.