Rookie Paul DeJong homered, singled twice, scored three runs and had three RBIs to help St. Louis snap a three-game skid.
Matt Carpenter and Dexter Fowler connected in succession to cap a four-run sixth inning, Tommy Pham hit a two-run drive in the seventh and Jedd Gyorko added a solo shot in the ninth.
Coming off a four-hit shutout against Philadelphia, Martinez (6-5) gave up one run and four hits. The right-hander has 45 strikeouts over his last five starts.
Kevin Gausman (3-6) allowed five runs in 5 2/3 innings.