Los Angeles, CA (SportsNetwork.com) - Giancarlo Stanton knocked in three runs and the Miami Marlins salvaged a three-game series with a 5-4 win over the Los Angeles Dodgers on Wednesday night.

Dee Gordon went 4-for-5 and scored a pair of runs and Sam Dyson (2-0) picked up the win by recording the final two outs of the sixth for the Marlins, who had dropped their last three games.

A.J. Ramos blanked the Dodgers in the ninth to notch his first save of the season.

Enrique Hernandez smacked a two-run homer and Joc Pederson added a solo shot for Los Angeles, which had its five-game winning streak snapped.

The Marlins used five straight singles to begin the seventh, with base hits by Adeiny Hechavarria and pinch-hitter Ichiro Suzuki coming against Adam Liberatore (0-1). Gordon's single loaded the bases.

Martin Prado plated Hechavarria with a liner to center and Stanton's rocket to center pushed across Suzuki and Gordon to put Miami in front 5-4.

"We were able to keep the line moving," Marlins manager Mike Redmond said.

Marcell Ozuna then bounced into a force out at second and pitcher Chris Hatcher tossed Prado out at home following Christian Yelich's roller to the mound. Michael Morse walked, but J.R. Realmuto struck out to end the threat.

Bryan Morris fired a perfect home seventh and Mike Dunn tossed a flawless eighth.

Miami scored a run in the third and another in the fourth to jump out to a 2-0 lead. Stanton's RBI groundout in the third and Jarred Cosart's RBI single in the fourth accounted for those runs.

The Dodgers tallied a run in the home fourth and three more in the fifth to go ahead.

Alex Guerrero cracked a triple to right and scored on a wild pitch in the fourth. Andre Ethier walked to lead off the fifth and Hernandez followed with his two-run shot, a liner over the wall in left-center. Pederson's blast made it 4-2 in favor of Los Angeles.

Game Notes

The Marlins' starter Cosart surrendered four runs on five hits and three walks over 5 1/3 innings, while Carlos Frias allowed three runs on six hits and a walk over six frames ... Miami was 4-for-14 with runners in scoring position ... Pederson's homer was his 10th of the year ... Dodgers manager Don Mattingly was ejected in the fourth for arguing a challenge.