LOS ANGELES (CBSMiami/AP) — A road trip that had turned ugly for the Miami Marlins ended on a positive note.

Dee Gordon had four hits against his former team, Giancarlo Stanton had a decisive two-run single in the seventh and the maligned Marlins’ bullpen finished off a 5-4 win over the Los Angeles Dodgers on Wednesday night.

READ MORE: Miami GP To Join F1 Calendar From 2022 In 10-Year Deal

Gordon, who was traded from the Dodgers to the Marlins in December, had two doubles and scored twice for his first hits and runs against the team that drafted him in the fourth round in 2008.

The Marlins (16-19) rallied from a two-run deficit by stringing together five consecutive singles in the seventh, capped by Stanton’s hit that made it 5-4.

Relievers Sam Dyson, Bryan Morris, Mike Dunn and A.J. Ramos combined for 3 2-3 shutout innings after starter Jarred Cosart departed with a tight right hamstring. Ramos pitched a perfect ninth for his first career save since Steve Cishek lost his closer job.

Enrique Hernandez and Joc Pederson each homered for the Dodgers (22-11).

The Marlins avoided a three-game sweep with the win and snapped the Dodgers’ five-game winning streak.

Cosart gave up five hits and four runs in 5 1-3 innings before having to leave the game after pulling up lame after Alex Guerrero’s single, but the Marlins bullpen was there to pick up the slack.

The unit, which entered with a 4.71 ERA, allowed only one hit the rest of the way as the Marlins finished their 10-game road trip on a high note.

READ MORE: Hollywood PD Investigating After Body Found In Burning Car

The Dodgers trailed 2-1 in the fifth before a two-run homer by Hernandez and a solo homer by Pederson put them up 4-2, but the Marlins fought back.

After the first three batters in the seventh singled to load the bases, Martin Prado laced an RBI single up the middle to bring the Marlins’ within one. Stanton followed with the hit that put them in front for good.

TRAINERS ROOM

Marlins: SP Henderson Alvarez (right shoulder and elbow inflammation) will make one rehab start with Triple-A New Orleans before coming off the disabled list, Redmond said. Alvarez pitched six scoreless innings for Class-A Jupiter on Tuesday in his first outing since going on the DL April 13.

Dodgers: OF Yasiel Puig will be out “a few weeks” after aggravating his strained hamstring in a rehab game last week, Mattingly said. There is no timetable for his return. … Closer Kenley Jansen (foot surgery) made the last of six one-inning rehab appearances with Class-A Rancho Cucamonga on Wednesday night and is scheduled to be activated from the DL on Saturday.

UP NEXT

Marlins: David Phelps (2-0, 2.90) looks to continue his surge since moving from the bullpen to the rotation when the Marlins return home and open a three-game series against Atlanta on Friday. Phelps is 1-0 with a 1.80 ERA in five starts since he entered the rotation.

Dodgers: Brett Anderson (2-1, 3.52) takes the mound to open a four-game home series against Colorado. The veteran left-hander didn’t allow an earned run in five innings to beat the Rockies his last start. He pitched for Colorado in 2014.

MORE NEWS: FEMA-Funded Vaccine Sites To Resume Administering First Doses Of Pfizer Vaccine With J&J Shot Paused

(TM and © Copyright 2015 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2015 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)