Pinch-hitter Derek Dietrich hit an RBI triple with two out in the ninth inning Sunday, and the Miami Marlins beat the St. Louis Cardinals 5-4 to earn a split of their four-game series.

The score was tied with two out in the ninth when Adeiny Hechavarria — who had made a costly throwing error earlier — singled off Matt Bowman (1-3). Dietrich then hit a drive into the left-field gap, and center fielder Tommy Pham's try at a diving backhanded catch failed, allowing Hechavarria to score without a play.

The teams finished their season series with Miami leading St. Louis by one game in the NL wild-card race.

Andrew Cashner allowed one earned run in six innings in his debut for the Marlins. Cashner, the centerpiece of Miami's seven-player trade Friday with San Diego, walked none and allowed four hits, including a homer by Greg Garcia.

Cardinals shortstop Aledmys Diaz left the game in the first inning with a bruised right hand after being hit by a pitch. Diaz, who is hitting .312 with 14 homers, is to undergo further examinations Monday.