FALMOUTH — After splitting a pair of regular-season games with Kennebunk, Greely knew what needed to be done in Tuesday’s Class B South boys’ hockey quarterfinal.

Greely got the job done, producing a 5-2 win at Family Ice Center to advance to the semifinals against Gardiner at 8 p.m. Friday.

“We talked a lot about – and this was true when we played them last Thursday – that we needed to get the game down below the dots,” said Greely Coach Barry Mothes. “We wanted to use our speed and agility, and we do have some good quickness. Kennebunk is a bigger and more physical mature team, so we had to use that quickness. The first time we played them we were kind of hanging on the perimeter, and it led to getting stripped and pushed around. Fortunately, we learned our lesson.”

Getting the game deeper in the Rams’ territory led to success throughout for the Rangers, who got two goals and an assist from freshman Matt Kramlich.

With 6:19 to go in the first, Greely defenseman Adam Rost collected a pass from Kramlich and sent a wrister toward the net from just inside the blue line.

His shot slipped in under the goalie Spencer DesRochers’ right pad for 1-0 lead.

Kennebunk tied the game with 1.6 seconds left in the period when Brenden Whitten picked up a loose puck in his own end and skated the length of the ice before he sent a backhanded shot into the top left corner of the net.

The Rangers made it 2-1 with 6:52 in the second period when the Rams couldn’t clear a loose puck in front of the net. After Ian Grant put a drive on net, Peter Lattanzi pushed the ricochet home for the lead.

With both teams skating with a man in the box, Kramlich skated the length of the ice and uncorked a shot over DesRochers’ pad for a 3-1 lead with 1:29 left.

Early in the third period, neither team managed a shot on net until 6:44 in when Kyle Beaupre scored on a pass from Justin Wiggins to pull Kennebunk within one.

A minute and a half later, Andy Moore pushed the Rangers’ lead back to two when he drove a Jack Saffian pass into the back of the net.

Kramlich iced the win when he forced a turnover near center ice and unleashed a blistering drive into the back Kennebunk’s empty net with under 30 seconds to play.