The Maryland baseball team had a tough time separating itself from James Madison throughout its game Tuesday evening.

When the Terps looked poised to take control early with a five-run second inning, the Dukes plated five runners in the bottom of the frame.

And when Maryland took a 12-9 lead in the sixth, James Madison responded with three runs across the final three innings, including a two-run double in the ninth, to send the game into extras.

But in the 10th inning, the Terps broke through with seven runs, and the Dukes couldn’t crawl back. Behind a season-high in runs, Maryland defeated James Madison, 19-12, in a game that ended about six-and-a-half hours after it started at Veterans Memorial Park.

With both pitching staffs struggling, the game was tied at nine when lightening struck in Harrisonburg, Virginia, at 8:47 p.m.

When play resumed almost two hours later, though, the Terps (22-18) pulled away from the Dukes (17-24). Maryland scored three more runs to cap the interrupted sixth frame and right-hander Andrew Green took the mound at the bottom of the inning, allowing one total run before Dukes first baseman Kyle Weston hit a two-out RBI double in the ninth to extend the game.

But with two outs in the 10th, the Terps rallied to score seven times with the help of four walks, a hit by pitch, an error, a single and a triple.

Green pitched the remainder of the game after the delay to earn the win, responding to his blip in the ninth with a scoreless final frame.

Maryland, who hadn’t allowed more than nine runs since March 9, used five pitchers, surrendering a collective 14 hits. James Madison, meanwhile, combined to use eight hurlers, allowing 15 hits.

Right-hander Hunter Parsons and left-hander Tayler Stiles have been the Terps’ usual midweek starters, but Parsons wasn’t an option Tuesday night because he started Sunday’s contest in place of injured right-hander Taylor Bloom.

So Stiles took the mound at the beginning of the evening, though his performance only lasted 1.1 innings after he gave up five runs.

Right fielder Madison Nickens hit his seventh home run of the season to open scoring, but James Madison responded with a sacrifice fly to make it 1-1 after the first frame.

Then the Terps added another home run in the second, a grand slam from shortstop Kevin Smith to push their advantage to 6-1 by the inning’s end.

But in the bottom of the stanza after Stiles surrendered a run on a bases-loaded walk, right-hander Ryan Selmer replaced him. Selmer, though, allowed four more runs — one of which was issued to Stiles — to knot the game at six.

After left-hander Robert Galligan, who entered Tuesday with the bullpen’s best ERA, surrendered another run in the third, the Terps turned to their closer, right-hander Mike Rescigno.

In the fourth, third baseman A.J. Lee, replacing usual starter Andrew Bechtold, contributed an RBI double, but in the bottom of the frame, Dukes right fielder Adam Sisk answered with a solo home run to extend James Madison’s lead to 9-7.

Maryland’s comeback effort started in the sixth when Smith collected two more RBIs to knot the game at nine before the lightening delay.

When play resumed at 10:43 p.m., second baseman Nick Dunn didn’t waste any time tacking on an RBI single before designated hitter Nick Cieri notched an RBI double to give the Terps a 12-9 lead.

While Weston knotted the game in the ninth, the Dukes couldn’t contain the Terps offense in the breakout 10th inning.