The Cardinals swept a three-game series from the Padres after having suffered four straight losses.
Both teams scored three times in the first inning and the score remained deadlocked until Beltran hit his National League-leading 14th homer of the season. The blast came after Matt Holliday had opened the fifth with a single.
David Freese closed out the scoring with a solo shot in the seventh.
Lance Lynn (7-1) recovered from a rocky start to get the win with a six-inning effort. He gave up three runs on eight hits.
Jason Motte needed only nine pitches to get through a perfect ninth for his eighth save.
Jeff Suppan (2-3) was charged with the loss, giving up five runs on eight hits in 4 2/3. San Diego has lost five out of seven.