DOVER, N.H. — Gorham was ahead by a goal but gave one up late in the second period. Rams senior forward Travis Mansir knew what his team needed to do early in the third period against York.

“We knew we needed the next one because if they had scored they would have tied the game and gotten the momentum,” Mansir said. “We just came out hard and I saw the opportunity and I put the puck in. I didn’t think I was going to score but the puck managed to get under the goalie and go in and that motivated the team and we just kept putting the puck in the net.”

Mansir’s two-goal, three-assist effort led the Rams to a 6-2 win in a Western B quarterfinal game Tuesday at Dover Ice Arena.

Mansir’s second goal came when he took advantage of a neutral zone mistake by No. 3 York (11-7-1) and pushed his way through two defensemen then shoved the puck past goalie Eric Lindbom 17 seconds into the third period.

“We had control of the puck and turned it over and gave the puck up right down near the goalie,” York Coach Mike Vessey said. “The kid made a nice move to beat (the goalie) and that changed the momentum back to the Gorham side.”

Mansir’s third assist came when he kept chopping at a loose puck in the crease and got it to squirt to Carter Landry, who buried the short-range power-play bid.

York was called for six third-period penalties, including two 5-minute majors, making a comeback bid difficult. When Adam Peterson roofed a pass from Landry later in the period for Gorham’s second power-play goal, the contest was sealed.

No. 6 Gorham (12-5-2), the defending Western champ, will face No. 2 Yarmouth (11-7-1) in the regional semifinals Friday at The Colisee in Lewiston, at a time to be determined.

York won the regular-season meeting 6-4 on Jan. 17 with star forward Derek Neal scoring four goals and assisting on the other two.

Neal entered Tuesday’s game with 42 goals and 27 assists, averaging 4.5 points per game.

He assisted on a goal but was otherwise kept in check by Gorham’s defensive effort.

“He’s just a fantastic player. I told the boys that if we could keep Derek off the score sheet we’d have a good chance to win,” Gorham Coach Jon Portwine said. “It was just to keep him in mind and keep him close. I targeted one guy on each line and their job was to keep him close and sacrifice a little offense.”

Gorham led 2-1 after one period.

The first goal came on the Rams’ seventh shot in the first 3:06 of play when Carl Bear scored on a rebound.

York tied the game on a sweet one-time redirection by Tommy Carr after Neal had drawn defenders with a rush from center ice, then deftly sent a pass across the crease.

Gorham regained the lead when Mansir crashed through York defenseman Colin Palmer, taking the puck away and quickly firing a low shot that beat Lindbom to the short side.

The Rams increased their lead to 3-1 with a short-handed goal.

Defenseman Andrew Schmidt swiped the puck from Neal behind the net, and his clearing chip got past the York defense at the point, sending Mansir in on a breakaway. Lindbom stopped Mansir’s shot but Jordan Ward was on the spot to cash in the rebound.

York benefited from its next power-play opportunity when Nick Walsh tipped in a hard shot from the point from Wyatt DeLise with 1:43 to play in the second period.

Gorham goalie Noah Bird made 26 saves for the win.