Chicago finished off its first three-game sweep in St. Louis in 22 years.
The Cardinals tumbled eight games behind first-place Cincinnati in the National League Central. Cincinnati's magic number for clinching the division crown dwindled to 10.
Carlos Zambrano (9-6) allowed a lone earned run on four hits in six innings to get the win. He has won his last six decisions.
Carlos Marmol came on with two on and one out in the ninth and earned his 31st save.
Chris Carpenter (15-7) pitched into the seventh before leaving the game with a hamstring cramp. He gave up five runs on seven hits in the loss.
Carpenter took a 2-1 lead into the seventh but gave up a leadoff single to Ramirez, an infield single to Xavier Nady and a homer to right by Colvin. Back-to-back doubles by Koyie Hill and Micah Hoffpauir accounted for another run in the seventh.
With Blake Hawksworth on the mound in the eighth, Marlon Byrd opened the inning with a double and scored in front of the 23rd homer of the year from Ramirez.
St. Louis has lost five of its last six.
Chicago's last three-game sweep in St. Louis had come on June 10-12, 1988. The Cubs have won five straight in St. Louis for the first time since 1983.