The shot to left field, which bounced onto the roof and over the Marlins' office building, was Stanton's second three-run home run in as many games. The slugger has four homers and 12 RBIs this spring.
Jake Marisnick had three singles and scored two runs for Miami, and Stanton went 2-for-3 before being lifted for a pinch-runner in the fourth inning.
Backed by Stanton's blast, Jacob Turner was able to cruise through five innings, as the right-hander gave up one run on two hits with three walks and three strikeouts.
Astros lefty Dallas Keuchel, competing for a rotation spot, entered the game with nine scoreless innings spread over three games. In four innings, he was tagged for seven runs on 13 hits.
"I've had a good go-around the first few starts in spring with fastball command, and today it was a little spotty at first and I was too stubborn to get away from it," Keuchel said. "Seven runs later, we made an adjustment and started breaking off some curveballs and some sliders, and the last two innings were a lot better."
The Astros led by a run in the first inning on Chris Carter's sacrifice fly to center field. Turner was hurt by a one-out walk to Jonathan Villar. The Marlins right-hander also committed a throwing error while trying to pick Villar off first. Marc Krauss' single moved Villar to third, and he scored on Carter's fly ball to center.
Derek Dietrich padded Miami's lead with an RBI double in the seventh inning.
Steve Cishek threw two scoreless innings of relief with two strikeouts for Miami.
Houston's Anthony Bass also tossed two shutout innings.
Up next: The Astros will be on the road again Wednesday, facing the Nationals in a 6:05 p.m. ET game in Viera, Fla. The game will be available on MLB.TV. Jarred Cosart will make his fourth start of the spring for Houston, having allowed six earned runs in seven innings thus far. Much of that damage came last Friday; the 23-year-old right-hander struck out the side in the first against the Cardinals, but he couldn't keep it going, allowing five runs in 3 1/3 innings. Prospect Mike Foltynewicz is scheduled to pitch in relief, along with Josh Zeid and lefty Kevin Chapman.
Joe Frisaro is a reporter for MLB.com. He writes a blog, called The Fish Pond. Follow him on Twitter @JoeFrisaro. This story was not subject to the approval of Major League Baseball or its clubs.