The loss dropped the Angels back into a tie for the American League West lead with Oakland, which won 8-2 in Houston.
Stanton and Trout entered the final interleague series of the season for both clubs leading their respective leagues in extra-base hits and total bases. Stanton also tops the National League in homers, RBI, on-base percentage and slugging percentage. Trout, runner-up in AL MVP voting each of the past two seasons, was this year's All-Star Game MVP.
"It's cool, but I wasn't anticipating it or circling it on the schedule or anything like that," Stanton said. "I was looking forward more to seeing my family than seeing him."
Jarred Cosart (2-1) allowed a run and seven hits over 7-2/3 innings. He struck out four in his fourth outing since he was acquired from Houston at the July 31 trade deadline. The right-hander, who was 9-7 with the Astros, lost his shutout bid in the eighth on an RBI double by Kole Calhoun.
"I tried to attack the strike zone, first and foremost," Cosart said. "That's one of the best lineups in the game, and you know the names on the backs of the jerseys in the middle of it. So if you get those guys out and get complacent, then the bottom of the order can hurt you. Then when they flip it back over, you're in a world of hurt."
Christian Yelich, a native of Thousand Oaks, California, and a product of the baseball camp run by Angels manager Mike Scioscia, was 3 for 5 with a pair of RBI singles and a double.
"I think I was 8 or 9 when I want to his camp, so it's been a while. There were a lot of kids at those things, so I didn't think he would have any idea," Yelich said. "It was kind of weird today, stepping in the box and looking in the other dugout, and he was sitting right there. I just remember him giving speeches and stuff. It ended up paying off."
Wade LeBlanc (0-1) was charged with six runs and seven hits in 3-1/3 innings as a replacement for Garrett Richards, out for the season because of a torn patellar tendon in his left knee that occurred last Wednesday in Boston. This was LeBlanc's first big league start since May 6, 2013, when he lost at San Diego while pitching for the Marlins.
"The first time through the order was pretty smooth, but they did a good job making adjustments -- and obviously I didn't," LeBlanc said. "I knew the adjustments I needed to make, and I just didn't execute them. That's a good hitting ballclub over there, and they're pretty hot right now. I didn't give this team much of a chance at all."
The Marlins opened the scoring with a three-run third and made it 7-0 in the fourth with Stanton's 33rd homer, a line drive to left-center off Cory Rasmus that increased his RBI total to 97. It was the 150th career homer for the two-time All-Star right fielder, four shy of Dan Uggla's franchise record.
"The difference between a four-run game and a seven-run game is like night and day, because they can put up four runs in an inning with no problem," Stanton said.