MIAMI -- Marlins ace Jose Fernandez was struck in the thigh by a sharp grounder and kept pitching despite discomfort. Dodgers right fielder Yasiel Puig slammed into the wall trying unsuccessfully for a game-saving catch and crumpled to the warning track in pain.
A seesaw struggle Sunday left both teams hurting, but it stung more for Los Angeles. Miami improved baseball's best home record when Jeff Baker hit an RBI double off the wall with two outs in the ninth inning to win 5-4.
Puig slammed into the wall trying for an acrobatic catch and was shaken up but not seriously hurt. Teammates ran out to check on him while the Marlins celebrated a wild victory.
Yasiel Puig slammed his head and lower left leg against this fence. He passed a concussion test and is day to day.
"Just exactly how we drew it up," manager Mike Redmond said with a grin.
Fernandez avoided a serious injury in the fifth when he was hit on the back of the left leg by a sharp grounder off the bat of Dee Gordon. Asked whether he expected to make his next start, Fernandez said, "Probably I will be fine."
The Marlins improved to 13-5 at home, while their 2-10 road record is the worst in the majors.
"We have a comfort level here," Redmond said. "I love our approach here. We seem to play with so much confidence in this ballpark, and today you could just feel the energy."
Giancarlo Stanton homered twice and drove in three runs for Miami, giving him the NL leads with 10 home runs and 36 RBIs. Teammate Christian Yelich hit his second home run.
Los Angeles came from behind three times, and a blown save cost 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, and a retreating Puig slammed his head and lower left leg against the fence. The ball deflected off the wall and hit Puig in the face, and he collapsed to his stomach.
Puig was slow to walk off the field but passed a concussion test. The Dodgers said his status is day to day.
"He hit the wall good," manager Don Mattingly said. "He seemed to be OK when he was walking in, but I'm sure they are going to keep looking at him. He almost made an unbelievable play."
Fernandez briefly thought his day might be done when Gordon's comebacker struck him.
"It hit me hard," Fernandez said. "Right away my hamstring became really tight. I didn't know if I was going to keep throwing. After that it was a little tougher to pitch. It was getting tighter and tighter and tighter."
Fernandez went on to pitch 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.
"It wasn't an easy game," Fernandez said. "Like everybody knows, the Dodgers are one of the best teams in the league. That's why they get paid the way they get paid."
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.
Stanton lived up to his reputation for jaw-dropping homers. He hit a two-run tape-measure 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.
"It's almost like you sort of get used to it, which is crazy," Redmond said. "The second one was like a 54-degree wedge you want to keep down in the wind. I don't know if I've ever seen a baseball hit that hard on a line."
NOTES: 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).