Pujols hit his 31st home run of the season in the first off Scott Olsen to give the Cardinals a 2-0 lead.
Wellemeyer (12-6) gave up five hits and struck out seven. Ryan Franklin got the final two outs to record his 15th save.
Felipe Lopez drove in two runs for the Cardinals, who won for the second time in eight games and remained six games behind the Brewers in the wild card race. Milwaukee beat San Diego 1-0.
Dan Uggla homered for the Marlins, who fell 7 1/2 games behind the Mets in the NL East. Florida was coming off its first back-to-back wins since July 30-31.
Scott Olsen (6-10) lost his sixth straight decision. Olsen, who last won July 19 against Philadelphia, went six innings, gave up five hits and four runs.
With the score tied at 3, Pujols drew a walk to start the sixth and took second on Ryan Ludwick's fly to deep right field, just beating the throw from Luis Gonzalez. He scored on a single to center by Yadier Molina.
The Cardinals added their fifth run in the eighth on Lopez's sacrifice fly to right field that scored Ludwick.
Josh Willingham hit a solo home run for Florida in the third and Uggla gave the Marlins a 3-2 lead with a two-run shot in the fourth. It was his 30th of the season, one off his career high.
The Cardinals tied the score at 3 in the fourth on a two-out single by Lopez. The play was set up when third baseman Jorge Cantu's throw pulled Uggla off the base on a potential double play that would have ended the inning.