MIAMI (AP) For a change, the Marlins won't spend the offseason as cellar dwellers.
Clinching an escape from last place, the Marlins rallied in their home finale Thursday to beat the Philadelphia Phillies 6-4. Casey McGehee had three RBIs, including a two-run, tiebreaking double in the seventh inning.
The victory ensured the Marlins (76-82) will end a streak of three consecutive last-place finishes in the NL East. The Marlins wound up 42-39 at home, their first winning record since Marlins Park opened in 2012.
''It was a good way to end the season at home and leave a good taste in your mouth,'' McGehee said. ''The future's bright. We took a lot of positive steps this year, and I think the expectations should be high next year. I'm looking forward to it.''
Thanks to a four-run seventh, Tom Koehler (10-10) finally reached double figures in victories for the first time. He had gone winless in his six previous starts despite a 3.50 ERA.
''The offense picked me up in a huge way,'' Koehler said. ''It's amazing how the mood can change in seven minutes.''
Koehler allowed four runs in seven innings. Steve Cishek pitched a perfect ninth for his 39th save in 43 chances.
Philadelphia (72-87) sewed up last place in the division and finished 36-45 on the road.
Phillies rookie David Buchanan gave up two runs in 5 1-3 innings and remained without a victory in nine starts since Aug. 10, even though he allowed less than four earned runs in his final 16 starts.
''I hope I made a good impression, and hope I can take this momentum into spring training and earn a spot,'' Buchanan said.
The Marlins trailed 4-2 before scoring four runs on five hits against Jake Diekman (5-5) in the seventh. An error by third baseman Cody Asche allowed one run to score, and Donovan Solano's single tied the game before McGehee put the Marlins ahead.
They scored more than two runs for only the fourth time in 13 games since losing NL home run leader Giancarlo Stanton to a season-ending facial injury.
''That seventh inning was a huge relief,'' manager Mike Redmond said. ''That's exactly what we've been waiting on. That was an exciting way to finish the year at home.''
Phillies 2B Chase Utley has largely avoided needing treatment while missing only seven games at age 35. He has a chance to play in 155 games, his highest total since 2009.
Phillies: RHP Jerome Williams (6-7, 4.71), who hasn't allowed an earned run in his past two starts, takes the mound for the Phillies when they open their final series of the season Friday at home against Atlanta.
Marlins: Top Miami prospect Andrew Heaney (0-3, 5.33) makes his first start since July 5 in the second game of a doubleheader Friday at Washington. RHP Jarred Cosart (4-3, 2.29) pitches for the Marlins in the first game.
ROUGH DAY, ROUGH YEAR
The Phillies' Ryan Howard struck out four times and leads the majors with 188 strikeouts while batting only .219.
The Marlins will finish last in the National League in attendance for the ninth time in 10 years at 1.7 million, a per-game average of 21,386. They drew an enthusiastic crowd of 24,259 Thursday.
''To win the final game and have the crowd behind you feels good,'' Koehler said. ''Hopefully they come out again next year and get ready for a little bit longer season.''