Bryan Morris (5-3) picked up the win by retiring both batters he faced.
A.J. Ramos pitched the ninth for his 29th save in 35 chances. Ramos hit Odubel Herrera with a pitch to lead off the inning, but retired the next three batters.
Alec Asher (0-5) pitched seven innings allowing one run and three hits for the Phillies. He struck out four and walked one.
Derek Dietrich singled with one out in the seventh and scored on Realmuto's triple to deep center field.
It was the seventh triple of the season for the Marlins catcher, the most by a major league catcher with a minimum of 80 games caught since Darrell Porter of the Kansas City Royals had 10 in 1979, according to STATS.
The hits by Dietrich and Realmuto were the first allowed by Asher since one in the first inning.
The Phillies were 1 for 7 with runners in scoring position and left five men on base.
Marlins starter Jarred Cosart left the game after four innings with a left forearm contusion. Cosart took a line drive hit by Cody Asche off the forearm in the fourth inning. He stayed in to finish the inning.
Cosart went back out to the mound to pitch the fifth, but was replaced by Jose Urena without facing a batter. Cosart allowed four hits and two walks. He struck out two.
Miami's Martin Prado, who was out with a wrist injury, played for the first time after missing five games. He entered the game in the eighth as a defensive replacement and singled in his only at-bat.
Marlins: RHP Hunter Capps (elbow) threw a simulation game Thursday and "threw the ball very well and based on what he just featured out there, pretty close to ready, if not ready," manager Dan Jennings said. . SS Adeiny Hechavarria (hamstring) was available to play in the game after taking live batting practice from two minor leaguers before the game. He has not played since Sept. 2.
Phillies: RHP Jerad Eickhoff (1-3, 3.16 ERA) will face Nationals RHP Jordan Zimmermann (13-8, 3.49) on Friday to begin a three-game series at Washington.
Marlins: RHP Jose Fernandez (5-0, 2.18) takes the mound on Friday in the Marlins' final home series of the season. The Braves will start RHP Ryan Weber (0-1, 3.26).