The win by the Pirates offset the Cardinals' 9-1 thumping in Thursday's first game of the best-of-five series and assures there will be two games in Pittsburgh. Game 3 is scheduled for Sunday afternoon with the fourth game Monday.
Cole (1-0) gave up two hits over six innings. He walked one and struck out five. One of the hits he allowed was a fifth-inning home run by Yadier Molina but the Pirates were ahead 5-0 before that.
Pittsburgh limited St. Louis, which had 10 hits Thursday, to four hits overall with the Pirates' bullpen backing Cole with three innings of two-hit, one-walk relief.
Pittsburgh reached Cardinals starter Lance Lynn (0-1) for five runs and seven hits in 4 1/3 innings.
Cole drove in the first run of the game with a two-out single in the second and the Pirates went up 3-0 the next inning when Pedro Alvarez connected for a two-run home run.
Martin added a seventh-inning sacrifice fly and Starling Marte hit a home run in the eighth to complete the scoring.