NEWARK, N.J. — David Desharnais scored the tying goal with 37 seconds left in the third period and added a goal in the shootout, and the Montreal Canadiens rallied for a 4-3 victory over the New Jersey Devils on Wednesday.

Lars Eller also scored in the third period and shootout for Montreal, which also beat the Devils at home Monday night.

Rookie Reid Boucher, making his NHL debut, scored for the Devils in the shootout, breaking a string of 20 straight missed chances by the Devils, who are 0-5 in shootouts this season.

Patrik Elias’ unassisted goal at 18:54 had given the Devils a 3-2 edge, but Desharnais redirected a slap shot by Brian Gionta to score at 19:23 to force overtime.

The teams combined for five goals in the third period.

The Devils led 2-1 before Eller scored on a backhand to tie the score at 2-2 at 16:10.

Andrei Loktionov and Michael Ryder each scored in the third period to give the Devils a 2-1 lead.

Gionta scored in the first period to give Montreal a 1-0 lead and goalie Peter Budaj made it hold until Loktionov scored 4:19 into the third period to tie it at 1-1. Ryder’s seventh goal broke the tie at 9:50.

FLYERS 6, RED WINGS 3: Sean Couturier had two goals and two assists, and Philadelphia scored four goals in the third period to rally at Detroit.

Couturier got the winner at 8:28 of the third period.

Scott Hartnell and Matt Read had a goal and two assists, and Steve Downie and Claude Giroux had a goal and an assist each for Philadelphia. Steve Mason stopped 32 shots.

Tomas Tatar scored twice and center Johan Franzen also scored for Detroit.

NOTES

RANGERS: Goalie Henrik Lundqvist, a Vezina Trophy winner in 2012, agreed to an undisclosed contract extension.

BLUE JACKETS: Vezina Trophy winning goalie Sergei Bobrovsky will be sidelined for four to five weeks with a groin strain.