When Maryland baseball left fielder Marty Costes stepped into the box in the fifth inning of Sunday’s rubber match, the Terps still had plenty of time to stage a comeback.

The Terps still have three Big Ten series remaining after their three-game set with Michigan State, giving them ample time to make a push to qualify for the eight-team Big Ten tournament.

Still, the Terps’ three-game series against the Spartans felt like a must-win for a team that entered the finale in 10th place in the conference, and that fifth-inning opportunity felt like a must-score for a team that has struggled to produce in big-time moments.

But on Sunday, Costes crushed a grand slam over the left-field scoreboard, powering the Terps to a 5-3 win, securing their first series victory in a month.

“Every game from here on out is a must-win,” Costes said. “I feel like we play better when our backs are against the wall.”

Coach Rob Vaughn subscribes to the belief that a team is defined by its response to adversity. But at points this year, Vaughn’s squad has struggled to get back on track following rough moments. The Terps’ 4-2 loss to the Spartans (16-23, 7-7 Big Ten) on Friday was their seventh straight Big Ten defeat.

Costes has had similar struggles.

The junior opted to return to College Park instead of joining the Houston Astros organization after being drafted in the 25th round of the 2017 MLB draft. But he’s hit significantly worse than he did last year, and was suspended for the Purdue series after violating team rules.

Back in the lineup this weekend, Costes hit the ball hard this series — but only had a double to show for it entering Sunday.

“The couple of at-bats before, I hit some good balls,” Costes said. “I was waiting for [second baseman Nick Dunn] to get on and I knew it was a good opportunity for me.”

After Dunn hammered two homers off Michigan State pitching on Saturday, clubbing the Terps (19-24, 5-9) to an 8-2 win, Spartans starter Mike Mokma (1-3, 4.81 ERA) pitched around him in the fifth inning. The four-pitch free pass loaded the bases for Costes, whose grand slam put the Terps up, 4-1.

“It released some pressure, made the rest of the game a lot easier,” catcher Justin Morris said. “He just had a good weekend and a really good day today.”

Then, when starter Tyler Blohm loaded the bases in the bottom of the fifth, Costes laid out in left-center field to rob a would-be RBI hit and end the threat.

Blohm (5-2, 4.10 ERA) allowed a first-inning run following a leadoff triple, but minimized damage throughout his outing. He emerged unscathed from two walks in the sixth, his final inning, to supply Maryland with a third solid start this weekend. Blohm allowed three hits, walked five and had four strikeouts.

“He doesn’t feel 150 percent, but what’s impressive about him is just how he’s gone out and competed for us,” Vaughn said. “He didn’t have his best command today and still turns in six innings.”

Regular starter Taylor Bloom entered in the seventh for his first appearance since suffering a concussion and threw a scoreless inning, but after Maryland added an insurance run with an RBI double from third baseman Taylor Wright, Bloom struggled in the bottom of the eighth.

The Spartans scored two runs to cut Maryland’s lead to 5-3, but closer John Murphy kept them at bay in the ninth inning, and with nine Big Ten games remaining, the Terps jockeyed themselves into a better position for a run toward qualification for the conference tournament.

“All we can really do is try to win as many series as we can,” Morris said. “We don’t really have any other option.”