MIAMI — Adam Morgan’s epic losing streak is finally over.

Morgan snapped his major league-worst streak of nine consecutive losses, Odubel Herrera scored three runs and the Philadelphia Phillies spoiled Miami slugger Giancarlo Stanton’s return by beating the reeling Marlins 4-3 on Tuesday night.

Morgan (2-9) allowed five hits and one run in six innings. He hadn’t won since May 10, going 0-9 with a 6.72 ERA in his last 15 appearances, 13 of those starts.

“It’s good to see because he needed to make a change in his approach and pitch differently than he has in the past and he’s starting to do that,” Phillies manager Pete Mackanin said. “He can get better and better.”

Morgan was staked to a 2-0 lead before his work even started, and was never in any serious trouble. His command wasn’t great — 85 pitches, 54 strikes — but he didn’t issue a walk and lowered his ERA from 6.21 to 5.90.

“Feels good. It feels good,” Morgan said. “Defense made some awesome plays behind me. But you know, it’s been the same game plan. … Keep it down, keep it simple and we just went out and executed.”

Tommy Joseph and Freddy Galvis each drove in two runs for the Phillies.

Ichiro Suzuki hit the first pinch-hit home run of his career, a two-run shot in the eighth for Miami. Stanton was activated from the disabled list about an hour before the game and delivered a pinch-hit single in the fifth for Miami, which lost for the 10th time in 11 games.

Jose Urena (3-6) gave up four runs and seven hits in five innings for Miami, which is 11-23 since Aug. 1.

“I was trying to stay down in the zone,” Urena said. “And I did, but they found holes.”

Jeanmar Gomez pitched the ninth for his 35th save in 39 chances for the Phillies. It was eventful — Maikel Franco threw a potential game-ending double-play ball into center field to give Miami runners on first and second with one out in the ninth, but Gomez got Ichiro to line out and then struck out Dee Gordon looking to end the game.

With Morgan’s losing streak now over the distinction of having the longest such active drought in the majors goes to San Diego’s Christian Friedrich and the New York Mets’ Logan Verrett, both losers of eight straight decisions.

Meanwhile, the jolt the Marlins got from Stanton’s return wasn’t enough.

Stanton lined a sharp single off Morgan in his return, jogging to first and being removed for a pinch-runner. The Marlins also activated first baseman Justin Bour from the 60-day DL on Tuesday, after he missed two months with an ankle injury. Bour reached on a walk in the eighth.

The Marlins were still firmly in the wild card mix in late August, but time is running out.

“Obviously, we’re not in a great spot right now, at this moment,” Marlins manager Don Mattingly said. “But again, I talk about it a lot — things can change quickly.”

HERRERA LOVES MIAMI

Herrera has three games in which he’s scored at least three runs, and two of them have come in Marlins Park — the other on Aug. 21, 2015. His career best for runs in a game is four, set on April 23 at Milwaukee.

FOR STARTERS

Morgan giving up one run extended a streak of success for Phillies’ starters against the Marlins in 2016. In nine of the teams’ last 11 games, Philadelphia’s starter has been charged with no more than two earned runs.

OLYMPIC VIBE

Ashleigh Johnson — a Miami native who was the goalie for the gold medal-winning U.S. women’s water polo team at last month’s Rio de Janeiro Olympics — threw out the ceremonial first pitch.

TRAINER’S ROOM

The Marlins had LHP Wei-Yin Chen (elbow) and RHP Bryan Morris (back surgery) throw in the simulated game to Stanton and Bour. Chen could return to the rotation before the season ends.

UP NEXT

The series ends Wednesday with Phillies RHP Jeremy Hellickson (10-8, 3.88) going up against Marlins RHP Andrew Cashner (4-11, 5.00). Hellickson is 2-0 with a 2.13 ERA in four starts against Miami this season.