Miller (2-2) entered the game with an 0-5 record and a 5.93 ERA against the Pirates. He allowed just three hits and four walks while striking out four.
Matt Holliday had three hits, a walk and drove in the only run with a first-inning double. Cardinals catcher Yadier Molina singled in the eighth inning to extend his hitting streak to 15 games, matching his career high set in 2007.
Pirates starter Gerrit Cole (2-2) pitched seven innings and allowed a run on six hits with three walks and four strikeouts.
The Pirates lost for the seventh time in nine tries. Pittsburgh has won just three of its last 12 games.
St. Louis got the only run it would need in the first. Matt Carpenter led off with a bunt single down the third baseline and he went to second on Jon Jay's fielder's choice to first. Holliday then doubled to right, scoring Carpenter.
Pittsburgh had Miller on the ropes in the third, as singles by Cole and Jose Tabata and a walk to Neil Walker loaded the bases. But Miller got Andrew McCutchen to hit into a 6-4-3 double play to end the inning.
In the eighth, Pittsburgh had runners on first and third with no one out against Martinez after pinch hitter Starling Marte was hit by a pitch and Tabata singled him to third. Martinez got Marte hung up on a fielder's choice back to him for the first out. After an intentional walk to McCutchen, Martinez struck out Pedro Alvarez and Chris Stewart to end the threat.
NOTES: Pittsburgh's Francisco Liriano (0-3) will try to get in the victory column when he opposes Tyler Lyons (0-1) in the second game of the series Saturday. . . . Cardinals shortstop Jhonny Peralta snapped an 0-for-22 streak with a fourth inning double. . . . Pittsburgh catcher Russell Martin left the game after grounding out in the fifth with tightness in his left hamstring. . . . This series is the last three games of a 26-game stretch against Central Division opponents to open the season for the Pirates.