PITTSBURGH (AP) -- The Miami Marlins have some ground to make up if they are to make it to the postseason for the first time since 2003.
However, comeback wins like they had Tuesday night give the Marlins hope as Adeiny Hechavarria had two hits and drove in a run during a decisive five-run rally in the eighth inning to help the Miami Marlins beat the Pittsburgh Pirates 6-3.
The Marlins are 5 1/2 games behind the first-place Washington Nationals in the National League East and the same amount out of the wild card race.
''Every game from here on out is important,'' Marlins left-hander Brad Hand said. ''We're going to try to win every game we can in August and September and hope that keeps us playing into October.''
Hechavarria's RBI single made it 4-2 after Marcell Ozuna and Jarrod Saltalamacchia drew bases-loaded walks from Justin Wilson to force home the tying and go-ahead runs. Christian Yelich capped the inning with a run-scoring double.
That came after Gregory Polanco put the Pirates ahead 2-1 in the seventh with a run-scoring single.
''We're not necessarily known for drawing walks,'' said Marlins manager Mike Redmond, though his team is fourth in the NL in that category. ''We had a lot of really good at bats that inning.''
Giancarlo Stanton and Garrett Jones also had two hits for Miami. Ozuna drove in two runs as he also had an RBI double in the fourth to tie the game at 1-1.
Pittsburgh's Jordy Mercer had two hits, including a run-scoring double in the third inning.
A.J. Ramos (5-0) got two outs in the seventh inning for the win.
Jared Hughes (6-3) took the loss, though he could have gotten out of the eighth without allowing a run if not for third baseman Josh Harrison booting a potential double play grounder with one out. Hughes put himself in trouble by walking Stanton to start the inning.
''I've got to get ahead in the count there,'' Hughes said. ''Walking the tying run with no one on base is going to come back to get you and it did today.''"
The Marlins had scored just 11 runs in losing four of their previous five games and a total of 13 runs while losing six straight games at Pittsburgh.
Hand did not pitch at least seven full innings for the first time in four starts but had a solid 6 1/3-inning outing. The left-hander allowed two runs and six hits while walking one and striking out two.
Hand has a 2.72 ERA in seven starts since being recalled from Triple-A New Orleans.
Pittsburgh starter Charlie Morton gave up only one run and six hits in seven innings with four walks and four strikeouts.
Marlins: Saltalamacchia returned to the lineup after missing the previous two games with lower back stiffness.
Pirates: Center fielder Andrew McCutchen was diagnosed with a fracture in his lower left ribcage after leaving the Pirates' previous game Sunday at Arizona in the eighth inning when he felt pain while swinging a pitch. He is hopeful of avoiding the disabled list. . Left fielder Starling Marte was activated from the 7-day concussion DL after being out since July 22. . Second baseman Neil Walker was back in the lineup after sitting out two games with tightness in his lower back. . Right-hander Gerrit Cole, on the DL with a strained right lat, had a rocky rehab start for Triple-A Indianapolis as he gave up five runs and 10 hits in 4 1/3 innings against Toledo in the International League.
Marlins: Right-hander Tom Koehler (7-8, 3.70) will start Wednesday night. He has struggled on the road this season with a 4.96 ERA, compared to a 2.45 mark at home.
Pirates: Left-hander Jeff Locke (2-3, 3.77) will try for his first career victory against the Marlins as he is 0-2 with a 3.55 ERA in four stars against them.
TIME'S UP FOR TURNER
Right-hander Jacob Turner was designated for assignment and left-hander Brian Flynn was recalled from Triple-A New Orleans. Turner, 23, was the key player who came from Detroit from the July, 2012 trade that sent right-hander Anibal Sanchez and second baseman Omar Infante to the Marlins. Turner was 4-7 with a 5.97 ERA in 20 games, including 12 starts, this season. During his time with the Marlins, he was 8-19 with a 4.41 ERA in 47 games.
Pirates third baseman Pedro Alvarez was placed on the bereavement list to attend the funeral of his wife's grandmother. He may miss up to three games under major league rules.