Javier Baez capped a four-run, ninth-inning rally with an RBI-single, and the Chicago Cubs rallied past the Giants, 6-5, in Game 4 of the 2016 National League Division Series in San Francisco on Tuesday night.

The come-from-behind victory gave Chicago a 3-1 series win and allowed the Cubs to advance to the National League Championship Series for the second consecutive season. They’ll play the winner of the Dodgers-Nationals series starting Saturday in Chicago.

After Giants’ starter Matt Moore held the Cubs to two runs on two hits with 10 strikeouts over eight innings, five San Francisco relievers combined to allow four runs in the ninth, including Wilson Contreras’ two-run single that tied the game, 5-5. Baez’s subsequent single plated Jason Heyward with the go-ahead run.

One night after blowing a series-clinching save, Chicago closer Aroldis Chapman came on to strike out the side and end the Giants’ even-year World Series win streak at three.

Hector Rondon got the win for the Cubs. Will Smith took the loss for San Francisco.

2016 NLDS Recap: Cubs defeat Giants, 3-1
Game 1: Chicago 1, San Francisco 0
Game 2: Chicago 5, San Francisco 2
Game 3: San Francisco 6, Chicago 5 (13)
Game 4: Chicago 6, San Francisco 5
Home team in bold