Boston Bruins goalie Tuukka Rask watches as the puck flies into the net while Boston Bruins defenseman Adam McQuaid (54) shoves Montreal Canadiens center David Desharnais during the third period at TD Garden in Boston Sunday.

BOSTON — David Desharnais scored the winner with his second goal of the game less than four minutes after Max Pacioretty tied it earlier in the third period, lifting the Montreal Canadiens to a 4-3 comeback win over the Boston Bruins in a matchup of the Eastern Conference’s top teams Sunday night.

Tomas Plekanec also scored for the Canadiens, who jumped two points ahead of Boston for first overall in the conference.

Peter Budaj made 31 saves for Montreal, which played the first of five straight road games.

Tuukka Rask stopped 22 shots for the Bruins, who had a six-game winning streak halted.

Pacioretty’s slap shot from the point beat Rask, who appeared to be screened, and tied the game 3-all 5:31 into the third period. Desharnais scored out of a scramble in front with 10:43 to play.

Boston pulled Rask with 70 seconds left for an extra skater, but Budaj stopped Seguin’s bid from close in the final seconds.

Trailing 2-1 early in the second period, Boston tied it on Bergeron’s goal. Seguin, who scored the Bruins’ first goal, made a cross-ice pass during a 2-on-1 break. Bergeron knocked in his own rebound after Budaj stopped the initial shot from the edge of the crease.

The Canadiens nearly regained the lead when Pacioretty clearly beat Rask with a blast from the right circle, but it caromed off the left post. Less than a minute later, Travis Moen broke in alone, but Rask dropped to his knees to cut down the angle and make the save.

Boston then grabbed its only lead of the night on Hamilton’s goal while the teams were skating four aside. Brad Marchand fired a shot from the right circle that rebounded over to Hamilton, who slipped a tough-angle shot by Budaj from the bottom of the left circle for his second career goal.

Shortly after Boston had moved ahead 3-2, Montreal peppered Rask with a number of good chances during a 5-on-3 power play.

The longtime rivals played an up-and-down clean first period before some bad feelings surfaced late in the second. Alexei Emelin appeared to cross-check Bruins’ young star Seguin on the right hip, sending him to the ice in pain.

Boston captain Zdeno Chara then raced in, nailed Emelin and the pair squared off to the left of Montreal’s net, with Chara throwing most of the punches. Seguin headed down the ramp toward the dressing room, but came back to the bench a few minutes later. Chara collected an instigating penalty, fighting major and 10-minute misconduct, leaving Boston short-handed on defense for a good portion of the third.

Montreal had moved ahead 1-0 on Plekanec’s power-play goal midway into the opening period. Michael Ryder, a member of Boston’s 2011 Stanley Cup winning team, sent a pass into the slot to Plekanec, who barely got the edge of his stick on the puck before the change-of-direction shot slid past Rask.

Boston tied it at 1 on Seguin’s goal 50 seconds later when he redirected Marchand’s pass by Budaj, but the Canadiens regained the lead 16 seconds after that on Desharnais’ goal.

Desharnais’ pass slid into the net off the stick of Boston defenseman Johnny Boychuk. The score was reviewed because it initially looked like Pacioretty had the puck carom in off his left skate.

NOTES: The Bruins did a number of different things during the game to support Newtown, Conn. One was having Sandy Hook Elementary School’s lead teacher, Natalie Hammond, drop the ceremonial first puck. ... The Bruins next play at Washington on Tuesday. ... Boston F Chris Bourque was a healthy scratch. ... The Canadiens continue their road trip at the New York Islanders on Tuesday before playing at Carolina, Tampa Bay and Florida, respectively. Their next home game is March 13 against Ottawa. ... It was the 719th all-time meeting between the teams, second only to Detroit-Chicago’s 724. ... Boston entered the day leading the league with a 91.9 percent penalty killing success rate, but gave up a power-play goal after allowing two Saturday against Tampa Bay.