The Colorado Rockies beat the Chicago Cubs 2-1 in the longest sudden-death game in Major League Baseball history.
It took four extra innings to decide Tuesday's National League Wildcard match, with Tony Wolters making the winning hit in the 13th.
The winner-takes-all game means the Cubs, the 2016 World Series winners, are eliminated from post-season.
The Rockies go on to meet the Brewers in the National League division series.
"This is going to go down as a classic, and it was great to be a part of," Rockies manager Bud Black told ESPN.
Both teams had lost a tie-breaker Monday to end up in the wildcard game.
The longest previous wildcard match went to 12 innings as the Kansas City Royals beat the Oakland Athletics in 2014. Game seven of the 1924 World Series also lasted 12 innings, with the Washington Senators beating the New York Giants.
As well as setting a new record for the longest game by innings, Tuesday's match at Wrigley Field was also the longest by time, lasting four hours and 55 minutes.