BINGHAMTON, N.Y. – The Binghamton Mets used a wild finish to move within percentage points of the Eastern League Eastern Division lead.

Josh Rodriguez led off the bottom of the ninth with a double and scored the winning run on a two-out wild pitch to lift the Mets over the Portland Sea Dogs 6-5 Monday afternoon.

Binghamton pulled out the win by scoring in each of the last five innings. The Mets tied the game by scoring twice in the fifth, moved in front in the sixth, rallied again in the eighth and won in the ninth.

One day after having every batter in the lineup strike out at least once, the Sea Dogs got at least one hit from every batter. The 13-hit attack, however, was offset by three runners caught stealing, including one that was part of one of Binghamton’s two double plays.

Binghamton (29-22) won the final three games of the four-game series. Portland is 28-21 for a slight winning percentage advantage — .571 to .569.

The missed chances started in the first inning when the first four batters reached, but only one scored and the Sea Dogs left the bases loaded.

“We missed some opportunities early,” Sea Dogs Manager Kevin Boles said. “We have to manage the strike zone better.”

Portland had eight hits in the first five innings. Shannon Wilkerson scored the first two runs for the Sea Dogs, extending the lead to 2-0 in the fifth after his bunt single.

Binghamton starter Jacob deGrom and Sea Dogs starter Brandon Workman each struck out nine in six innings to help the teams combine for 25 strikeouts.

“I thought deGrom’s stuff kicked up a little bit when the occasion rose, but we have to manage our ABs a little better,” Boles said.

Wilkerson, Michael Almanzar, Travis Shaw and Kolbrin Vitek all had two hits, but Matt Spring’s eighth-inning double was the only extra-base hit by the Sea Dogs.

The Mets got three extra-base hits from Allan Dykstra (a home run and two doubles) plus lead-off doubles in the eighth and ninth innings to tie and win the game.

Darrell Ceciliani doubled to center field to start the eighth and scored on Joe Bonfe’s sacrifice fly.

Rodriguez started the ninth with an infield ground-rule double.

After taking third on a Cesar Puello groundout, Rodriguez stayed put as reliever Jeremy Kehrt struck out Dykstra. Kehrt then threw an 0-2 pitch in the dirt well in front of the plate with Cory Vaughn batting, allowing the winning run to score.

Boles was ejected in the sixth inning when he took over for Spring, who argued after being called out on strikes.

Tensions rose between the teams, causing players to come out of the dugouts for the second time in the series. This time, Mets Manager Pedro Lopez argued with umpires that Workman had balked, then wound up exchanging words with Workman.

More players took the field earlier in the series when Tony Thomas of the Sea Dogs yelled at the Mets’ dugout after he was hit by two pitches in a game.

Boles began Monday’s postgame interview by saying he would not comment on the situations.