MIAMI - Pinch-hitting pitcher Travis Wood had an RBI double with two outs in the 13th inning, giving the Chicago Cubs a 5-4 victory over the Miami Marlins.

Called on to bat for reliever Carlos Villanueva (3-5), Wood hit a sharp groundball off Jacob Turner (2-5) down the left field line, scoring Junior Lake for the go-ahead run.

Wood, who is batting .250 this season, was 0 for 4 as a pinch hitter entering the game.

Miami's Tom Koehler was near perfect to start, retiring 14 of the first 15 batters. Only Mike Olt registered a hit against the Marlins' starter during that stretch.

But the Cubs overcame a 3-0 deficit in the sixth inning, highlighted by Starlin Castro's three-run homer.

After the Marlins were unable to turn a double play on pitcher Justin Hammel's bunt, Luis Valbuena and Justin Ruggiano followed with singles. Hammel ended Koehler's shutout when he scored on a groundout by Anthony Rizzo.

Castro then gave Chicago a 4-3 lead with a three-run homer, his 10th of the season.

The Marlins responded in the bottom half. Marcell Ozuna led off with a triple and scored on a sacrifice fly by Adeiny Hechavarria.

Hammel allowed four runs and eight hits. He struck out nine in six innings.

Giancarlo Stanton put the Marlins on the board in the first inning with his 19th home run, a two-run line drive that just cleared the right field wall.

Miami padded its lead in the third when Stanton scored on Casey McGehee's single to right.

The Marlins failed to convert with the bases loaded in the seventh. Garrett Jones grounded into a forceout at home and Ozuna struck out looking.

NOTES: The Marlins observed a moment of silence for Hall of Famer Tony Gwynn, who died Monday. ... The Cubs improved to 3-6 in extra inning games this season. The Marlins fell to 4-6. ... Castro registered his 11th three-hit game and now shares the major league lead in the category with Colorado's Troy Tulowitzki. With his home run in the sixth, Castro picked up his eighth extra-base hit in his last 10 games. ... The Cubs intentionally walked Stanton in the 11th inning, giving the Marlins slugger 14 intentional passes this season. Stanton trails only Boston's David Ortiz (15) in intentional walks. ... Jake Marisnick and Justin Bour, both recalled from Triple-A New Orleans, saw action in Monday's game. Marisnick batted leadoff in place of the injured OF Christian Yelich and finished 2 for 6 with run, a walk and two stolen bases. Bour struck out in a pinch-hit appearance for Koehler in the sixth inning, ... The teams continue the series Tuesday night, with Chicago RHP Jeff Samardzija (2-6) facing RHP Anthony DeSclafani (1-1).