Harper, who snapped a 1-for-10 funk, also singled and walked twice as the Phillies evened their seven-game series with Miami at 2-2.
"The last couple of weeks my team has picked me up for sure," Harper said. "Everybody was swinging the bats really well. I was just standing there. As an organization, as a whole, these guys have been cheering me on and wanted me to do my best.
"If we're going to be successful as an organization as a team, I have to play better. It's plain and simple."
Gregorius gave the Phillies an early lead with his blast in the first. Gregorius drove a slider from Miami starter Jose Urena (0-1) over the wall in right field for his seventh homer of the season.
Harper increased Philadelphia's advantage to 5-0 with a leadoff shot in the third.
"Really encouraging because we're going to need his bat down the stretch," Philadelphia manager Joe Girardi said of Harper. "When a guy that good goes through some struggles, he's going to get hot. We know he can carry a club. He hit balls hard everywhere."
Phillies starter Spencer Howard left with right shoulder stiffness after allowing Brian Anderson's three-run homer in the fourth. The rookie right-hander had kept the Marlins hitless through the first 3 2/3 before Jesus Aguilar singled. Matt Joyce walked and Anderson followed with his sixth homer. Howard walked two and struck out five.
"Every time we got anywhere close, it seemed like they ran on us again," Miami manager Don Mattingly said.
Aguilar had three hits, including his sixth homer for Miami.
Urena, who celebrated his 29th birthday Saturday, yielded six runs and five hits. He walked four and struck out two.
REALMUTO REMOVED LATE; SCARY MOMENT FOR HOSKINS:
J.T. Realmuto was removed in the ninth inning as a precaution. Girardi said Realmuto felt hip discomfort
"We'll evaluate him (Sunday) and see where's he at," Girardi. "We just have to see how he is and keep our fingers crossed."
First baseman Rhys Hoskins avoided serious injury when he attempted to catch Realmuto's errant throw on Corey Dickerson's dribbler in the seventh. The throw led toward the baseline, where Hoskins and Dickerson collided. Hoskins favored his left arm and was treated by Phillies training staff but remained in the game.
ANOTHER MAJOR LEAGUE DEBUT:
Reliever Johan Quezada pitched a scoreless ninth and became the 17th Marlin to make his major league debut this season, setting a team record. The previous mark was set in 2010.
Phillies: LHP Jose Alvarez (testicular contusion) has been throwing from 60 feet and will be re-evaluated Tuesday.
Marlins: SS Miguel Rojas jammed his right middle finger in warm-ups before the game. Rojas singled in two at bats before Jazz Chisolm pinch hit for him in the sixth.
Phillies: Zach Eflin (2-1, 4.58) will start one of the doubleheader games against Miami Sunday. The second starter will be determined after all the options have been discussed Girardi said.
Marlins: Rookie right-hander Sixto Sanchez (2-1, 1.80) is scheduled to start one of the games Sunday. Mattingly said it has not been determined yet which end. The second starter will be announced.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Baltimore Orioles reach one-year deal with recovering Trey Mancini
— The Baltimore Orioles agreed to a $4.75 million, one-year deal with recovering slugger Trey Mancini on Friday but haven't come to terms yet with outfielder Anthony Santander.
New York Yankees roll dice on Corey Kluber: Will he return to Cy Young form?
If the longtime ace bounces back from two injury-plagued seasons, New York might have just reeled in one of the biggest fish of this offseason.
Sources: Corey Kluber, New York Yankees finalizing one-year, $11M deal
The New York Yankees are finalizing a one-year, $11 million deal with two-time AL Cy Young Award winner Corey Kluber, pending a physical, sources told ESPN.
Boston Red Sox, 3B Rafael Devers agree on one-year, $4.575M deal
The Boston Red Sox have agreed to a $4,575,000, one-year deal with third baseman Rafael Devers that avoided salary arbitration, a person with knowledge told the Associated Press.
Chicago Cubs avoid arbitration with Kris Bryant, Javy Baez
The Cubs avoided arbitration with Kris Bryant and Javy Baez. Bryant will make $19.5 million this season, and Baez will make $11.65 million.
Francisco Lindor, Michael Conforto among 8 New York Mets players to reach 1-year deals
The Mets reached one-year deals with shortstop Francisco Lindor, first baseman-outfielder Dominic Smith, outfielders Michael Conforto and Brandon Nimmo and pitchers Edwin Díaz, Seth Lugo, Miguel Castro and Robert Gsellman to avoid salary arbitration.