Each time Maryland baseball fell into a hole Saturday afternoon against Michigan State, they cut their deficit to one. But the first two times the Terps crawled back, they weren’t able to take the lead.

In the seventh inning, though, with Maryland’s postseason fate depending on the outcome of the game, the Terps, who entered the frame trailing, 4-3, broke through.

Maryland scored three runs in the inning to take its first lead of the contest. Behind strong pitching late in the game, the Terps held on to defeat the Spartans, 6-4, to win the series in East Lansing, Michigan, and clinch a spot in the Big Ten Tournament.

First baseman Kevin Biondic and second baseman Nick Dunn, who entered Saturday tied for the best batting average on the team (.290) led the Terps (28-25, 13-11 Big Ten) at the plate. The duo combined to record seven of Maryland’s 10 hits.

Right-hander Brian Shaffer, who entered Saturday with a 2.70 ERA, allowed four runs in eight innings despite early struggles.

On Shaffer’s fourth pitch of the game, center fielder Brandon Hughes hit the ball into Shaffer’s right knee, and the sophomore needed a few minutes to recover. Then Michigan State (34-18, 13-11), which took an early lead in the first two games of the series, got on the board first again Saturday with second baseman Dan Durkin’s RBI single.

In the third, Durkin continued to attack Shaffer, hitting a two-run home run to extend the Spartans’ lead to 3-0.

Maryland came within one in the fourth when designated hitter Madison Nickens grounded out to score Dunn and catcher Nick Cieri’s sacrifice fly drove home shortstop Kevin Smith.

In the bottom of the fourth, Michigan State scored again when third baseman Justin Hovis’ sacrifice bunt knocked in right fielder Kris Simonton. Shaffer then threw four scoreless innings, and the Terps cut their deficit to one again in the fifth when Dunn hit an RBI double.

In the seventh, Maryland took control. Designated hitter Dan Maynard was hit by a pitch with the bases loaded to tie the game. On the next batter, Biondic singled in Smith and Dunn.

Right-hander Ryan Selmer, who pitched 3.2 scoreless relief innings Friday, forced the final three outs to punch the Terps’ ticket to the conference tournament for the third straight year.