The Phillies rallied to tie it with a two-run ninth inning, one of the runs unearned due to a throwing error by shortstop Hanley Ramirez.
Ruiz came up in the ninth in a tie game with runners on first and second, but was left standing at the plate when Jayson Werth was thrown out at second on the back end of a double steal attempt to end the inning.
When he came up as the leadoff hitter in the 10th, Ruiz drove a 3-2 pitch over the wall in left off Will Ohman (0-1), Ohman, a 10-year veteran who was recently obtained by the Marlins in a trade with Baltimore.
The Ruiz homer made a winner out of Ryan Madson (4-1), who walked a batter but struck out the side in the bottom of the ninth.
Brad Lidge gave up a leadoff single in the Florida 10th, but struck out the next two batters and got Emilio Bonifacio on a fly ball to right to end the game. It was Lidge's 12th save.
Ruiz doubled home Philadelphia's first two runs to break a scoreless tie in the sixth.
The Phillies remained two games behind division-leading Atlanta in the National League East.
Copyright 2010 United Press International, Inc. (UPI).