No. 2 Boston University has had its share of explosive finishes this year, but tonight was a step above those.

Trailing 5-4 with less than seven minutes to play, the Terriers scored a whopping five goals in six minutes, 35 seconds, to beat Massachusetts by a deceptive 9-5 margin in front of 5,026 at Agganis Arena. BU senior Evan Rodrigues tied a school record with six assists, including four consecutive helpers in a span of less than five minutes.

Rodrigues was far from the only offensive hero for the home team. Ahti Oksanen notched his first collegiate hat trick, Jack Eichel added four points, and captain Matt Grzelcyk scored the game-winner along with two assists.

BU overcame any number of dumb penalties and a generally irresponsible showing in the defensive end in the win.

“It was surely an entertaining game,” BU coach David Quinn said. “Not an easy game to coach from either end of it. Obviously, penalties were a major problem for us tonight. You just can’t expect to take that many penalties and expect to have success … That being said, I really liked our start. I thought we were ready to go and had a lot of energy.”

Meanwhile, UMass coach John Micheletto ended the night screaming at the referees, and not without reason. After the officials called a very questionable five-minute major on BU’s Rodrigues early in the period, UMass scored twice during the extended man advantage. After that though, the officials overcompensated by giving BU five power plays over the course of the period. The Terriers scored on four of them and ended the night with a startling six power-play goals on eight opportunities

“I think I would prefer to decline the five-minute major if that’s the way the game is going to devolve at that point,” Micheletto said. “It was a really entertaining college hockey game … For that to devolve was a disservice to our league, I thought.”

On top of that, Micheletto was puzzled to see no penalty called when a BU goal was disallowed because Rodrigues ran over UMass netminder Henry Dill. How could it not be goaltender interference?

“Happy with our guys’ effort, thought they battled hard,” Micheletto said. “We fought a lot of adversity to get to where we were and for what happened to happen.”

The flip side for UMass was that the Minutemen were fortunate that the game wasn’t over in the first period when BU dominated and could have been up 4-1 rather than just 2-1. Just 2:03 into the game, Brandon Hickey scored on a power-play wrist shot from the right-wing circle. Then, at 13:39, Rodrigues and Eichel made a pair of deft passes to set up Danny O’Regan for the easy tap-in.

The Terriers acted as if the rout was on and paid for it.

“After we made it 2-0, the whole complexion of the game changed,” Quinn said.

Just 42 seconds later, a BU turnover led to a UMass goal for Dominic Trento.

BU made it 3-1 early in the second. Oksanen collected a pass off the left-wing boards and threw it at the net from a very sharp angle. Surprisingly, the puck went off Dill and in. UMass almost got that one back 19 seconds later, only to have a Frank Vatrano goal waved off because the puck was kicked in.

Still, UMass got a good bounce leading to a power-play goal minutes later. A shot from the point hit a BU defender and caromed to Troy Power low in the left-wing circle for a high shot that beat BU freshman Connor Lacouvee.

That set the stage for a crazy third period that yielded nine goals, seven on the power play. With Rodrigues serving the major, Shane Walsh and Vatrano scored to give the Minutemen a surprising lead. Oksanen then tied it up on a redirect of a Grzelycyk shot at 7:01, only to have UMass reclaim the lead a couple of minutes later when Riley McDougall scored after his teammates did a nice job of working the puck around the perimeter.

The final onslaught began with 7:21 remaining. Grzelcyk teed up a one-time slap shot blast from Eichel to make it 5-5. Just over a minute later, after yet another penalty, Grzelcyk fired a wrister through traffic for his first goal of the season.

Less than two minutes after that, Rodrigues made a terrific play off of a faceoff, carrying the puck across the slot and beyond the goal line before threading a pass by the goalie for an easy tap-in goal for Eichel on the other side of the crease. That made it 7-5.

Just 35 seconds later, Rodrigues knocked over the goalie while attempting to shoot, and the rebound caromed to Cason Hohmann, who beat Dill. The video review led to a disallowed goal but no penalty.

Undeterred by the waved-off goal, Rodrigues got his historic sixth assist by setting up Oksanen for his hat-trick goal. The six assists tied the team record jointly held by Ron Anderson in 1971-1972 and Jack Parker’s teammate Larry Davenport in 1967-1968.

“My linemates on the power play did a great job of getting open and buried on the chances they had, so a lot of credit to them,” Rodrigues said. “I was just trying to find the open man and got the luck of the draw.”

BU rounded out the scoring with a last-minute goal by Hickey, set up by Hohmann.

BU (16-4-4, 11-2-2 Hockey East) now has a four-game winning streak going into Monday’s Beanpot semifinal against Harvard. UMass (8-17-1, 3-12-1) is off until hosting Northeastern on Friday night.