Right fielder Yasiel Puig retreated and made a leaping try for an acrobatic catch but slammed against the fence, and the ball deflected off it and hit him in the face. Puig collapsed to his stomach and was slow to rise, and he walked off the field with an arm around a trainer.
The Dodgers came from behind three times, and a blown save cost Miami ace Jose Fernandez the victory. With Marlins closer Steve Cishek unavailable after pitching in three consecutive games, A.J. Ramos (2-0) tried to protect a one-run lead in the ninth for his first career save. But Chone Figgins walked and scored on a double by Andre Ethier with no outs.
A diving stop by shortstop Adeiny Hechavarria and an overturned call on a force play at second base helped the Marlins escape the inning with the score tied.
Hechavarria started the bottom of the ninth with a single off Jamey Wright (2-2) and advanced to third on a sacrifice and a groundout. Baker followed with a drive to right, only his seventh hit this season.
Fernandez pitched seven innings, left with a 4-3 lead and remained unbeaten at home in 20 career starts. But he lacked his customary command, allowing four walks, and they led to both earned runs against him.
Fernandez, the 2013 NL Rookie of the Year, has yet to allow more than two earned runs in a home start. The only other pitcher in the past 100 years to allow fewer than three earned runs in 20 consecutive home starts was Orel Hershiser in 1985-86.
The Marlins rank last in the NL in attendance but enjoy a bump when Fernandez pitches, and his latest win drew 30,145.
Hanley Ramirez, jeered throughout the series by Miami fans who became disenchanted with his play for the Marlins, drove in Los Angeles' first run with a two-out single in the third.
The Dodgers' Carl Crawford also had an RBI single. He was back in the lineup after he snapped a slump with a two-run pinch-hit homer in the 11th inning of Saturday's victory.
Stephen Fife, making his 2014 big league debut, gave up four runs in six-plus innings for Los Angeles. He was recalled before the game from Triple-A Albuquerque to start for left-hander Hyun-Jin Ryu, sidelined by a sore shoulder.
Stanton hit a two-run homer in the first inning, then lined another homer off the nightclub facade in left field leading off the sixth to put Miami ahead 4-3.
Yelich's second homer of the year landed in the upper deck in right field in the fifth.
For the second game in a row, the Marlins tied their single-game Marlins Park record of three home runs, and they have 21 homers in 19 home games this season. They hit 36 in their spacious ballpark in all of 2013, when they ranked last in the big leagues in most major offensive categories.
The Marlins' 13-5 record at home is the best in the majors, while their 2-10 road record is the worst.
NOTES: Fernandez avoided injury in the fifth when he was hit on the back of the left leg by a sharp grounder hit by Dee Gordon. ... OF Nick Buss, designated for assignment by the Dodgers on April 30, was claimed by Oakland. ... Zack Greinke (5-0, 2.04) is scheduled to take the mound when the Dodgers open a series Monday at Washington. ... Nathan Eovaldi (2-1, 2.58) is scheduled to start Monday for Miami against the New York Mets' Jonathan Niese (2-2, 2.20).