SAN FRANCISCO -- Joe Panik doubled off the right field fence to score Brandon Crawford with no outs in the bottom of the 13th inning Monday night, giving the San Francisco Giants a 6-5 win over the Chicago Cubs to force a Game 4 in their best-of-five National League Division Series.
Still down 2-1 in the series after being swept in Chicago, the Giants will send left-hander Matt Moore to the mound in another potential elimination home game Tuesday night. The Cubs will start right-hander John Lackey.
San Francisco, which captured World Series titles in 2010, '12 and '14, won its 10th consecutive game when facing elimination in the postseason.
Crawford led off the 13th with a two-strike double off the seventh Cubs pitcher, left-hander Mike Montgomery (0-1).
Panik followed with a blast over Cubs right fielder Albert Almora Jr.'s head, easily scoring Crawford with the game-winner.
The hit was Panik's third of the game.
Rookie left-hander Ty Blach (1-0) pitched two innings of two-hit shutout relief to get the win for the Giants, who out-hit the Cubs 13-10.
Montgomery (0-1) was starting his fifth inning of relief.
Having watched the Giants score three times in the bottom of the eighth inning to take a 5-3 lead, the Cubs rallied into a tie in the top of the ninth on a two-run home run by Kris Bryant (3-for-5) off San Francisco closer Sergio Romo.
The homer, which hit the top of the left field fence and bounced into the bleachers, came immediately after Romo walked leadoff hitter Dexter Fowler.
The Giants led all of baseball in blown saves during the regular season with 30.
San Francisco made a bid for a regulation win when, with Brandon Belt on first base in the bottom of the ninth, Buster Posey (3-for-5) hit a liner into the right field corner.
With Belt running from the crack of the bat, Cubs right fielder Albert Almora Jr. made a diving catch to save the game, then doubled Belt off first base to send the game to extra innings.
Cubs standout Aroldis Chapman also blew a save when he was called upon with two on and no outs in the eighth, Chicago clinging to a 3-2 lead.
Conor Gillaspie blasted a two-run, go-ahead triple off Chapman in a three-run uprising that gave the Giants the lead.
On the strength of a three-run home run by starting pitcher Jake Arrieta, the Cubs took a 3-2 lead into the eighth, but then had to call upon Chapman after Belt singled off Travis Wood and Buster Posey drew a walk from Hector Rondon to open the inning.
Chapman, pitching with a lead in the eighth inning for just the fourth time all season, struck out Hunter Pence for the first out, but then served up Gillaspie's triple to right-center field, scoring Belt and Posey with the tying and go-ahead runs.
The hit was just sixth of the season for Gillaspie, a left-handed hitter, against a lefty pitcher. Three went for extra bases.
Chapman never previously allowed a triple to a left-handed hitter.
The big hit was the second of the postseason for Gillaspie, whose three-run homer in the top of the ninth inning produced all the runs in the Giants' 3-0 win over the New York Mets in the NL wild-card game.
Brandon Crawford followed Gillaspie's triple with a single through a drawn-in infield to increase the San Francisco lead to 5-3.
Crawford then stole second and went to third on catcher Willson Contreras' errant throw, after which Joe Panik drew a walk, ending Chapman's night.
Right-hander Justin Grimm came on to retire both batters he faced, giving the Cubs one last shot in the ninth while down by just two runs.
The Giants fought an uphill battle from the time Arrieta smacked his homer off Giants starter Madison Bumgarner in the second inning.
The stunning blow came on a two-strike fastball from Bumgarner, who had never previously allowed a home run to a pitcher in regular-season or postseason play.
It was the first go-ahead, three-run homer by a pitcher in baseball postseason history, and it gave Cubs pitchers six RBIs in the three games against the Giants, tying the record for a postseason series.
Arrieta had two home runs in the regular season, tied for third most in the majors for a pitcher behind Bumgarner and the Mets' Noah Syndergaard (three apiece).
The runs were the first allowed by Bumgarner in the postseason since the ninth inning of Game 1 of the 2014 World Series against the Kansas City Royals.
Arrieta, who allowed at least three runs in nine of his previous starts, held the Giants to two in six innings. He gave up six hits and one walk while striking out five.
Bumgarner left for a pinch hitter after laboring through 101 pitches in five innings. He allowed three runs and seven hits, walked one and struck out four.
The Cubs' second inning began innocently enough when Addison Russell leaned into a fastball and got hit on the left elbow with one out.
The homer stopped Bumgarner's postseason scoreless-innings streak at 24. It was the eighth home run he allowed in 16 postseason games.
The Giants closed the gap to 3-1 in the third on Posey's second hit, a two-out, RBI single that scored Span, who had doubled.
Denard Span's one-out triple helped the Giants get within 3-2 in the fifth. Belt followed with a sacrifice fly, making it a one-run game.
NOTES: The Cubs fell to 3-5 in their history when they had a chance to close out a postseason opponent. ... Giants LF Angel Pagan (back spasms) was scratched from the starting lineup about an hour before the start of the game. He was replaced by Gregor Blanco. He was the only San Francisco position player who didn't get into the game. ... Giants RHP Jeff Samardzija, who was pulled after just two innings in Game 2 on Saturday, was available out of the bullpen -- and for use a pinch runner -- in Game 3, but he wasn't utilized. ... In response to Giants CF Gorkys Hernandez's controversial check swing in the ninth inning of Game 1, commissioner Rob Manfred noted at his pregame press conference that Major League Baseball is likely to continue its policy of not using instant replay to review balls and strikes.