The Marlins are getting used to working overtime. They’re getting used to winning extra-inning games, too.

Miami again dipped into the night with another extra-inning game on Wednesday night, beating the Brewers 5-4 on a walk-off single by Starlin Castro in the 12th inning. It was the second extra-inning game of the series and the fourth in the last six Marlins home games. Miami won three of those games.

Castro’s single in the 12th scored Garrett Cooper from second base after Cooper led off the inning with a single to right field. He moved to second on JT Riddle’s groundout, before Castro drove him in.

“We put a lot of good at-bats,” Castro said. “We’re fighting, we’re getting long at-bats. They come back in the eighth to tie the game. The pitching keeps the game tied. Finally, I’m the hero and I win.”

Marlins manager Don Mattingly said: “You feel like this team has gained an identity of how we play, or how we need to play to win games. And that’s really to do what we’ve been doing: getting our hits, moving runners, trying to get a guy in, trying to get some bags, we’re trying to be aggressive on the bases, and we’re pitching pretty good. This is our kind of game.”

Castro’s single to left wasn’t stung, and left fielder Christian Yelich — traded by the Marlins over the winter — had a chance to throw out Cooper at the plate. But third base coach Fredi Gonzalez waved Cooper in and Yelich’s throw ran up the first-base line.

Mattingly said he was not surprised Gonzalez sent Cooper home.

“We know Yeli,” Mattingly said. “Obviously, he’s a really good player. Probably the one downfall of him is he doesn’t throw great. He’s got a decent arm, but he doesn’t get rid of it quick and I know he’s working on it. That’s the one thing. You got to challenge there.”

The Marlins set a new record-low attendance Wednesday night by drawing just 5,265 fans. The previous record was 5,415 on April 30 against Philadelphia.

Right-hander Drew Steckenrider blew a two-run Miami lead in the eighth inning when Jesus Aguilar doubled home Eric Thames and Yelich to tie the game.

Dan Straily was solid again for the Marlins, delivering six innings of two-run ball. He struck out seven batters, tying a season-high, and did not allow a home run for the second straight start.

The start marked another checkpoint in Straily’s turnaround this season and was his fourth consecutive quality start.

Over the last four outings, Straily has a 3.20 ERA and a 1.066 WHIP. Wednesday was the first time with back-to-back homerless starts since last August, a stretch of 21 starts by Straily.

“I’ve just been trying to pitch like I know I’m capable of,” Straily said. “That’s really what it comes down to. I feel like especially last month, if it wasn’t one thing, it was the other. Just really excited to turn the calendar on that one and refocus into the new month.”

The Marlins starting rotation is speckled with question marks, pitchers with too little experience and others with guarded innings limits. It’s young, it’s developing and it may just have another anchor in Straily, as the second half of the season opens next week.

Straily’s recent resurgence is important for the Marlins, who need a reliable innings-eater to emerge and settle a sometimes volatile staff. In the last two seasons, Straily has been that guy. He topped 190 innings in 2016 with Cincinnati. He exceeded 180 innings last year in Miami.

Now that he’s recovered from a right forearm strain that held him out the first month of the season, Straily appears to be back to his old form. Straily’s performance could also open up a trade market for the 29-year-old who is the second-oldest member of the Marlins rotation. He also has two more years of club control and could add depth to a contender’s rotation.

“Just really focusing on a couple different things here that have been paying off in terms of getting a little deeper into ball games and making better pitches throughout ballgames,” Straily said.

The Marlins offense backed Straily with a three-run fourth inning off right-hander Freddy Peralta. Peralta buzzed through the first three innings with ease, allowing just a walk to Bryan Holaday. But Brian Anderson led off the third with a triple and spurred an inning that sent nine men to the plate.

Justin Bour crushed a solo home run and Straily helped his own effort by driving in a run with a bases loaded walk. It was Straily’s third career RBI.

The Marlins didn’t have a huge book on Peralta, making his seventh career start on Wednesday night. Miami knew Peralta threw a lot of fastballs. But they didn’t know how it moved or how it came out of his hand.

“Hopefully you figure it out, get a time through, guys start talking to each other, talk about the movement and what’s going on with it,” Mattingly said before the game.

Yelich had a chance to win the game for Milwaukee in the ninth inning, but Kyle Barraclouogh struck him out to leave the bases loaded.

Like the Marlins? Like our Miami Marlins Facebook page to keep up with the latest news »

[email protected]; On Twitter @MDeFranks.