The Rockies won their second straight and moved within 1 ½ games of idle San Francisco for the lead in the National League wild-card chase.
Cook (9-3) lasted six innings and allowed eight hits, but he gave up only a first-inning run. Cook also drew a bases-loaded walk in the second inning that brought the Rockies their first score.
Dexter Fowler's two-run single in the fourth put Colorado in front and the Rockies broke the game open on a three-run homer by Barmes in the sixth and a two-run blast by Smith in the eighth.
Chad Gaudin (4-8) suffered the loss despite giving up only one earned run on four hits with eight strikeouts over five innings.
The Padres have won just twice in their last 13 games.