The Cubs missed a chance to clinch on their own earlier in the day as they lost 3-2 to the Pittsburgh Pirates at Wrigley Field.
But it didn't matter as all Chicago needed to snap their lengthy playoff drought was to have the Giants lose. The Cubs are assured of at least a National League wild-card spot.
The Pirates moved 4 1/2 games ahead of the Cubs with eight regular season games to play in the regular season.
Pirates right-hander Gerrit Cole worked seven full innings for the win and closer Mark Melancon struggled before recording his 51st save.
The Cubs trail Central Division-leading St. Louis by 7 1/2 games with nine games left.
The Cubs haven't won a playoff game since the 2003 NL Championship Series and haven't won the World Series since 1908.