Hagelin skated out from behind the net and put a wrist shot on the short side behind Marc-Andre Fleury, who was equally as brilliant as Lundqvist. Hagelin's teammates stormed off the bench, while Fleury lay on the ice, despondent.
The Rangers, who got all four wins in the series by the same score, will play the winner of the Washington-New York Islanders series, which the Capitals lead 3-2.
New York also won Game 4 in Pittsburgh by the same score on Kevin Hayes' overtime goal, on which Hagelin assisted.
Lundqvist made 37 saves in Game 5, including a nifty stop on Brandon Sutter in the extra session that was wide open, a bit sloppy, but very entertaining.
Montreal leads the best-of-seven series 3-2. Game 6 is Sunday night in Ottawa.
Tom Gilbert had the lone goal for Montreal, and Carey Price stopped 20 shots.
The Senators went two for four on the power play. The Canadiens were 0 for 3.
Minnesota 4, at St. Louis 1: Devan Dubnyk had a strong bounce-back effort in goal and the Wild beat the Blues to take a 3-2 lead in the Western Conference first-round series.
After giving up six goals in two periods in a 6-1 loss in Game 4, Dubnyk made 36 saves in Game 5 and twice robbed Alexander Steen from close range in the second period.
The Wild scored three straight goals after Vladimir Tarasenko gave St. Louis the early edge with his playoff-leading sixth goal, including the fourth power-play tally of the series by one of the NHL’s weakest units in the regular season.
Nino Niederreiter scored the go-ahead goal in the second period, and Marco Scandella, Mikko Koivo and Charlie Coyle also scored for Minnesota. The Wild can wrap up the series at home in Game 6 on Sunday.
The Central Division champion Blues will be trying to avoid their third straight first-round elimination and bring the series back home for Game 7 on Wednesday night.