Christopher Morel homered, Dansby Swanson had two hits, reliever Drew Smyly (11-9) got the win and Michael Fulmer, activated from the injured list before the game, got the final two outs to register his second save for Chicago (78-67).
The Cubs remain three games behind the first-place Milwaukee Brewers (80-63) in the National League Central and two games ahead of the Arizona Diamondbacks for the second wild card.
Brenton Doyle hit a two-run single and pinch hitter Hunter Goodman had an RBI double for Colorado (51-92).
The game was delayed approximately 15 minutes in the third inning when plate umpire Brian O'Nora left for an undisclosed reason. Second base umpire Tom Hanahan moved behind the plate.
Chicago rallied in the ninth off Tyler Kinley (0-2). Swanson led off with a double, Ian Happ walked and both moved up on a double steal. Gomes then singled to center, giving the Cubs the lead.
Smyly pitched 1 2/3 shutout innings. Fulmer entered with one out in the ninth, then walked and hit a batter before striking out Harold Castro and Doyle.
The Rockies jumped on top 1-0 when Charlie Blackmon led off the bottom of the first with a double, moved to third on Ezequiel Tovar's groundout to second and scored when Nolan Jones grounded out to first.
Chicago tied it in the third on three straight singles, the last by Nick Madrigal. The Cubs went up 2-1 on Morel's solo homer in the fifth, his 22nd of the season.
Chicago extended the lead in the sixth inning. Cody Bellinger led off with a double, moved to third on Seiya Suzuki's bloop single to right, and Suzuki went to second on a wild pitch. With two outs, Gomes singled to left to drive in Bellinger, though Suzuki was thrown out at the plate on the play.
That was all for Kyle Freeland, who allowed three runs on eight hits in six innings. He fanned two without issuing a walk.
Cubs starter Jordan Wicks allowed one run in six innings and was poised for the win until Colorado rallied in the seventh inning off reliever Jose Cuas. With two outs, Elias Diaz singled, Elehuris Montero walked and Goodman doubled to left to make it 3-2.
Doyle then hit a two-run single to put the Rockies in front.
—Field Level Media