Updated

Zack Greinke pitched eight innings to help the Los Angeles Dodgers take a 4-1 win over the Miami Marlins in the third of a four-game set.

Greinke (12-3) gave up a run on six hits with seven strikeouts to win his fourth straight start for the Dodgers, who have won their past two after losing consecutive games for the first time since dropping two to the Padres on June 20-21.

"Maybe I'm pitching better than I realize," said Greinke. "I just haven't been making a ton of mistakes and fixes some mechanical stuff. My changeup has been the best it's been in my career."

Hanley Ramirez went 2-for-4 with an RBI and two runs scored while Andre Ethier and Jerry Hairston each drove in a run in the win.

Giancarlo Stanton's home run accounted for the offense for the Marlins, who have lost four of six. Nathan Eovaldi (2-4) dropped his fourth straight decision as he was charged with three runs -- two earned -- on six hits with a pair of walks and five strikeouts in three innings.

Stanton homered with two outs in the first to get Miami on the board, but the team stranded men on base over the next three innings.

The Dodgers took the lead in the fourth as Yasiel Puig reached base on a bad throw from Ed Lucas and Adrian Gonzalez followed with a walk. Ramirez then doubled home the first run and Ethier followed with an RBI single. A bad pickoff throw from Eovaldi then scored Ramirez for a 3-0 lead.

"We make way too many mistakes out there to be able to win a game against a team like this," said Miami manager Mike Redmond. "When you give a team like the Dodgers extra chances, they'll beat you every time."

After the Marlins went down in order in the fifth and sixth, Lucas singled to start the seventh, but was left there as Greinke retired the next three batters.

Los Angeles added to its lead in the eighth on Hairston's sac fly that plated Ramirez for a 4-1 advantage.

Greinke pitched a 1-2-3 eighth inning while Kenley Jansen tossed a scoreless ninth for his 21st save of the season.

Game Notes

Stanton has an eight-game hitting streak ... The Dodgers have won four of the six games against the Marlins this season ... Greinke improved to 3-0 in six games (five starts) against the Marlins ... Eovaldi fell to 0-2 in two games against the Dodgers.