Pujols had been slow to round back into form after missing nearly three weeks with a strained right oblique muscle, but over the weekend he had eight hits in 16 at-bats and hit several other balls hard.
The Cardinals rotation, which had an ERA over 6.00 in June, needed a lift, and right-hander Jason Marquis, the club's first 10-game-winner, gave the team that boost.
Marquis (10-6) stopped a personal two-game slide as he allowed the Royals four runs in seven innings on a brutally hot day. Marquis had been tagged for 23 hits and 20 runs in 11 innings over his previous two starts.
REPLAY: Albert Pujols hit his second homer since coming off the disabled list when he cracked a three-run shot in the third inning, and Jason Marquis singled home a run in a six-run inning.
The Cardinals needed every one of the runs as Brad Thompson, Braden Looper and Tyler Johnson had trouble putting the game away before Looper retired John Buck, representing the tying run, in the ninth inning to seal a 9-7 win over Kansas City.
--RHP Josh Kinney, a former independent league pitcher, had his contract purchased from Triple-A Memphis, and he became the Cardinals' 13th pitcher. Kinney, who had an ERA of 1.62 as a setup man, replaced OF Timo Perez, who was optioned to Memphis.
--Three Cardinals were named to the National League All-Star team -- 1B Albert Pujols by the fan vote, RHP Chris Carpenter by the players' vote and 3B Scott Rolen by NL manager Phil Garner. All were chosen last year, too, although Rolen was hurt and didn't go to the game.
--SS David Eckstein passed the 100-hit plateau in the club's 80th game by singling twice.
--1B Albert Pujols, CF Jim Edmonds and 3B Scott Rolen hadn't homered in the same game since July 2004.