Playing before the largest home hockey crowd of the season, the Portland Pirates eked out an important 4-3 win against the Manchester Monarchs on Saturday night at the Cross Insurance Arena.

It wasn’t easy.

Jordan Szwarz scored the winning goal on a power play with 2:04 left before an announced crowd of 5,276.

“It was a good crowd and it was nice to send them home with a win,” Coach Ray Edwards said.

“This is a team that has a lot of character and I think we showed it tonight,” Szwarz said.

The Pirates snapped a two-game losing streak and stayed within four points of the Providence Bruins for the eighth and final playoff spot in the AHL’s Eastern Conference.

The score was 1-1 at the end of the first period.

Alexandre Bolduc, who recently returned from a three-week stay with the Arizona Coyotes, opened the scoring nearly six minutes in. During the first power play of the game, he tipped defenseman Joel Hanley’s blast from the top of the right circle past Manchester goalie Jean-Francois Berube for his team-high 14th goal.

Four minutes later, Scott Sabourin tipped in defenseman Jeff Bolduc’s shot from center point for his third goal to tie the score.

With less than six minutes left in the first period, Portland center Justin Hodgman had a chance to tie the score. He was awarded a penalty shot after he was tripped up on a breakaway before he could get a shot off, but his backhander glanced off the left post.

The score was tied 2-2 at the end of the second period.

The Monarchs, who were limited to eight shots in the first period, came on strong during a power play early in the second, but goalie Mike McKenna, making his first start since returning from a two-week stint with the Coyotes, stopped five shots to keep the score tied.

Defenseman Evan Oberg sent the Pirates into the lead nine minutes into the period when his shot from the top of the left point went off the near post for his seventh goal.

Less than three minutes later, Nic Dowd scored on a breakaway for his fifth goal to tie it.

The Monarchs took the lead for the first time five minutes into the third period when Josh Gratton swept a rebound into the left side of the net after McKenna used his pads to keep a shot from Zach O’Brien out of the right side of the net.

Play was halted for nearly five minutes while Oberg was taken from the ice on a stretcher with a right leg injury.

“It was a hard-fought game and two points we needed to get,” Edwards said. “You hate to see a guy go down but you’ve got to find a way to finish the game and get the points.”

With less than eight minutes left, Brendan Shinnimin, converting Szwarz’s nifty centering pass from behind the net, put in a quick one-timer from the right of the slot for his 12th goal to make it 3-3.

Szwarz put the Pirates ahead to stay by scoring his ninth goal.

Chicago acquired center Antoine Vermette from Arizona for a first-round pick this year and defensive prospect Klas Dahlbeck, who will be assigned to the Pirates.