Gomes tallied his first runs since Game 1 of the ALDS in the sixth inning on Sunday, blasting a three-run home run off Seth Maness.
Lance Lynn got the start for St. Louis, looking for a win in his third straight outing. He lasted 5 2/3 innings, allowing three runs on three hits while striking out five batters.
Carlos Beltran got the first run of the game in the third, taking a Clay Buchholz pitch to right field to score Matt Carpenter. Buccholz lasted just four innings, giving up three hits and three walks while striking out a pair of batters.
Lynn found himself in a bases-loaded jam in the fifth and gave up they tying tally when David Ortiz beat Matt Holliday's throw from left field on a sacrifice fly by Stephen Drew.
After Gomes' homer, Carpenter cut the lead to 4-2 with an RBI single in the seventh. The Red Sox used four pitchers over the last 2 1/3 innings to close the door, including John Lackey, who made his first relief appearance since 2004.
Felix Doubront picked up the win after surrendering one run and striking out three over 2 2/3 frames.
The Cardinals had rookie Kolten Wong at first base in the ninth, but Koji Uehara picked him off to end the game.
Adam Wainright takes the hill against Jon Lester for Game 5 on Monday.