CHICAGO (AP) - Jason Heyward tied it with a single in the ninth inning and his liner to left-center in the 13th won it as the Chicago Cubs beat the San Francisco Giants 3-2 on Sunday to take three of four games in a possible playoff preview.
Anthony Rizzo led off the 13th with a single off Matt Reynolds (0-1) and went to second on Ben Zobrist's sacrifice. Addison Russell, who had three hits, was walked intentionally before Heyward drove in his third run of the game.
Trevor Cahill (4-4) worked a perfect inning in a series in which all four games were decided by one run.
The Cubs were staring at a second straight loss when Russell led off the ninth with a double against Santiago Casilla. He went to third on a wild pitch and scored on Heyward's single up the middle to hand Casilla his seventh blown save.
Each team had chances earlier in extra innings. Cubs closer Aroldis Chapman worked two scoreless innings, striking out Brandon Belt on a 102 mph fastball with two on to end the 11th.
The Giants' Cory Gearrin struck out Russell looking on a questionable call with a runner on second to end the 10th.
The Giants appeared on their way to the win in regulation despite managing two hits thanks to seven strong innings from Johnny Cueto and a perfectly executed suicide squeeze.
Eduardo Nunez doubled in the fifth, stole third then broke for home as Ehire Adrianza put down a soft bunt in front of the mound that forced John Lackey to throw to first and snapped a 1-all tie.
In his first start since Aug. 14 because of a shoulder strain, Lackey trailed 1-0 after 3 1/2 innings despite not allowing a hit.
Heyward was charged with a two-base error in the second when he couldn't make a running catch of Hunter Pence's fly to right-center. Pence scored the unearned run on Nunez's groundout.
After the Cubs tied it when Heyward's single scored Anthony Rizzo in the fourth, the Giants got their first hit an inning later on Nunez's one-out liner to the gap.
Lackey, on a pitch count, was lifted after 76 pitches, one earned run and one hit.
TRAINER'S ROOM
Giants: Manager Bruce Bochy didn't start SS Brandon Crawford and LF Angel Pagan with a day game Monday at Colorado. Both ended up pinch-hitting and Crawford
Cubs: Setup man Hector Rondon (triceps) could come off the disabled list as soon as Monday.
SCARY MOMENT
Giants 1B Brandon Belt stayed in after taking Rob Zastryzny's 87 mph fastball of his helmet in the seventh. Belt stayed upright as his helmet flew off, then walked to first after being looked at by the trainer.
NATHAN DEBUT
RHP Joe Nathan making his first appearance with San Francisco since the 2003 playoffs, struck out Kris Bryant in a perfect 12th.
SIXTH MAN
Chicago will stick with a six starters through another turn in the rotation, with LHP Mike Montgomery getting the ball Wednesday at Milwaukee.
UP NEXT
Giants: LHP Matt Moore (9-10, 3.88 ERA) flew early to Denver and starts Monday against Rockies RHP Chad Bettis (11-7, 5.17).
Cubs: RHP Kyle Hendricks (13-7) carries the majors' lowest ERA of 2.09 into Monday's start at Milwaukee against RHP Zach Davies (10-6, 4.07).