DENVER (AP) Garrett Hampson didn't think about being a hero. He only wanted to hit a ball deep enough to score Yonathan Daza from third.
His approach paid off and kept Colorado's faint playoff hopes alive.
Nolan Arenado homered twice for Colorado, which has won four straight and swept a series for the first time since June 18-20. It took a wild finish in which the lead changed three times after the seventh inning.
''It's not an easy thing to do in this game, so it felt good to do it,'' Arenado said of the sweep. ''I don't know if we're in it or out of it, we just have to focus on ourselves and win ballgames.''
The Rockies loaded the bases with no outs in the 10th against Jeff Brigham (2-2). Daza had an infield single, Raimel Tapia reached when his grounder got past Isan Diaz - the second baseman's second error of the game - and Ryan McMahon singled.
The Marlins brought right fielder Brian Anderson into the infield, leaving two outfielders. Brigham struck out Ian Desmond before Hampson lifted a 1-0 breaking ball to left to score Daza.
''I was hoping it was going to be deep enough and then I looked out there and there was nobody out there,'' Hampson said. ''Got the job done. It's what you play for. It's what you want to do.''
Arenado gave the Rockies a 4-3 lead in eighth inning with his 30th home run of the season, a two-run shot off of reliever Austin Brice. Colorado's Wade Davis, who moved back into the closer's role he lost to Scott Oberg two weeks ago, started the ninth by walking Jorge Alfaro. Lewis Brinson doubled and Neil Walker singled to tie it.
Carlos Estevez came on and allowed a sacrifice fly and Brian Anderson's double, which gave Miami a 6-4 lead. But Diaz couldn't field a grounder cleanly in the bottom of the inning, helping the Rockies tie it against Ryne Stanek.
Charlie Blackmon's RBI single and a sacrifice fly by Trevor Story sent the game to extra innings.
''Obviously I was just trying to get an out,'' said Diaz, who was playing in his 13th game since being called up from the minors. ''I was a little too quick to the ball, a little too fast. The thing is to catch the ball first. I didn't do it.''
Miami manager Don Mattingly said the rookie learned a tough lesson.
''We'll make sure we talk with him,'' he said. ''It is something I think that'll help him. You don't want to have that lesson. I've learned that lesson the same way. It's not an easy one to swallow, but you do come out on the other side of it.''
Blackmon hit his 26th homer in the sixth to cut the Marlins' lead to 3-2.
Harold Ramirez had three hits and two RBIs to help put the Marlins ahead. Starter Jordan Yamamoto struck out nine in 5 2/3 innings.
Rockies: RHP Oberg was placed on the 10-day injured list with a blood clot in his right arm. Oberg had a procedure to dissolve the clot at a hospital on Saturday and stayed overnight, manager Bud Black said. Colorado recalled RHP DJ Johnson from Triple-A Albuquerque.
Estevez was pitching for the second straight day and starting to feel the effects of throwing 31 pitches, so when Brinson came up with two outs and a runner on in the 10th, Black ran out to talk to him.
''I got a runner on, got two outs and he came out to check on me,'' Estevez said. ''I told him, `Honestly, I'm tired but I got one more in the tank.' He said, `Go get him, blow one by him.'''
Estevez struck Brinson out on three pitches, the last a 97-mph fastball.
''He was tiring a bit and I wanted to let him know he was still throwing the ball well,'' Black said. ''His matchup with Brinson was critical.''
Marlins: RHP Elieser Hernandez (2-5, 5.40 ERA) will open a three-game series at Atlanta starting Tuesday. It will be his third start and eighth appearance against the Braves.
Rockies: RHP Chi Chi Gonzalez (0-4, 6.57) takes the mound at Arizona on Monday for the start of a three-game series against the Diamondbacks.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Copyright 2019 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.