MIAMI (AP) — The Miami Marlins were down by five runs when they sent closer A.J. Ramos to the mound to pitch in the ninth inning.

That's a sign things aren't going well.

Ramos needed the work because the Marlins are in a skid, and they lost Thursday to the St. Louis Cardinals 5-1 to complete a three-game sweep.

Miami (30-44) fell a season-worst 14 games under .500.

"It's very hard," losing pitcher Dan Haren said in the clubhouse. "Obviously it's pretty much dead silent in here now. I don't know where to gauge it. Things aren't going well."

Haren (6-5) allowed four runs in six-plus innings.

The Marlins' Adeiny Hechavarria hit his fourth homer off the foul pole with two outs in the ninth to avert a shutout. They totaled four hits.

The Marlins have lost seven of their past eight games while scoring a total of 17 runs, and their defense is slumping, too. Second baseman Dee Gordon had two errors, doubling his season total.

Miami went 0 for 5 with runners in scoring position, and 1 for 17 in the series in those situations.

"We're 2 for 28 our last two series with runners in scoring position," manager Dan Jennings said. "That's not going to get it done."

Lance Lynn pitched six shutout innings in his first outing since June 7. Lynn (5-4), who had been on the disabled list with a strained forearm, allowed only two hits and lowered his ERA to 2.84.

Lynn improved to 4-0 lifetime in six games against the Marlins.

"That was a good one to come back to," he said.

"He was awesome," teammate Pete Kozma said. "He was doing what he did before he went on the DL."

Backup infielder Kozma, who came into the game hitless in his past 21 at-bats, singled three times, scored twice and drove in a run for his second RBI this year. His average rose to from .093 to .140.

The sweep was the first for the Cardinals in Miami since Aug. 4-7, 2011, and their first on the road this year.

"That's news to me," Matheny said.

The rarity of the road sweep is surprising given that the Cardinals (48-24) have the best record in the majors. They went 5-3 on a three-city trip to move a season-high 24 games above .500.

Haren retired the first seven batters before his pitch brushed Kozma, who scored on a two-out double by Kolten Wong.

The Cardinals added three runs in the seventh while hitting one ball hard. They reached on back-to-back bunt singles, Mike Dunn walked in a run, and Kozma scored on Mark Reynolds' popup to Gordon, who caught the ball in short right field with his back to the plate.

UP NEXT

LHP Justin Nicolino, who threw seven shutout innings against Cincinnati to win his major league debut, is scheduled to pitch Friday for Miami against the Dodgers.

"The Dodgers aren't going to care we got swept," Haren said. "They're going to try to win. We can't feel sorry for ourselves."