BOSTON (AP) -- The Montreal Canadiens were struggling through their worst stretch of the season. Then they had to play two of the hottest teams in the NHL.
They beat both - decisively.
Peter Budaj stopped 34 shots and the Canadiens ended the Boston Bruins' four-game winning streak with a 4-1 win Thursday night. The victory came just two days after they stopped Carolina's four-game winning streak with a 3-0 win.
''It's good for the confidence,'' Montreal coach Michel Therrien said. ''Even when things weren't going our way, we tried to stay positive.''
The Canadiens had been outscored 19-5 in losing four consecutive games. The Bruins had won their previous four games by a combined score of 21-8.
But Boston was outplayed from start to finish.
''We didn't skate. We didn't execute, and we didn't make good decisions,'' Bruins coach Claude Julien said. ''We weren't very good.''
The Canadiens were outstanding. Their speed and emotion put them in front of the Bruins all night long.
''This was close to a complete game for us,'' said Daniel Briere, who scored Montreal's last goal while playing just 7 minutes, 39 seconds. ''We needed that after spending the last week dropping some big games and by big scores as well.''
Alexei Emelin and Max Pacioretty scored before Dougie Hamilton's goal cut Montreal's lead to 2-1 after one period. Brian Gionta made it 3-1 at 11:54 of the second, ending goalie Tuukka Rask's night. He was replaced by Chad Johnson, who allowed the first shot he faced, by Briere, to get past him less than two minutes later.
Julien wouldn't say why he pulled Rask. And Rask said he felt OK.
''I play as long as they tell me to play,'' he said. ''You'd like to stop everything, right? But, today, I didn't.''
The Bruins had scored six goals in each of their previous three games. The Canadiens scored five times during their four-game slide.
''Usually, when you go through tough stretches, people have a tendency to panic,'' Budaj said. ''Tonight we played well against a really good team.''
The losing streak ended Tuesday night against Carolina when Carey Price stopped 36 shots in his third shutout of the season. Budaj was nearly as good while improving his career record in Boston to 4-0 with just five goals allowed.
''We played well against a really, really good team,'' he said. ''This building is always rocking. It's always exciting to play these type of games.''
Boston remained in first place in the Atlantic Division and second in the Eastern Conference but Montreal was aggressive from the start, quite a change from the Bruins' previous two games.
They outshot Florida 19-8 in the first period of a 6-2 win Tuesday night. That came one night after they took 18 of the first 20 shots in a 6-3 win over the New York Islanders.
But they fell behind early Thursday night and never caught up.
Emelin got his first goal in 32 games this season when he converted a slap shot from the right point with four players standing right in front of the crease just 2:16 into the game.
Pacioretty scored his team-leading 23rd goal at 14:32. He received a pass along the left side in center ice, skated behind the defense and put a short backhander behind Rask.
But Hamilton scored his fifth goal just a minute later.
Neither team had many good opportunities in the first half of the second period. But less than two minutes later, Tomas Plekanec took a power-play shot from the right circle and Gionta tipped it in for his ninth goal.
Briere finished the scoring with a shot Johnson had little chance to stop. With three Bruins chasing him and only the goalie in front of him, Briere fired a 10-foot forehand shot over Johnson's shoulder.
NOTES: Briere had a goal and an assist after getting just one assist in his previous 10 games. ... The Bruins fell to 12-3 in their last 15 home games. ... Budaj is 4-1 with one shutout in five career games against the Bruins. ... For the first time in the last 10 games between the teams, the final margin was more than one goal. The last time that happened was on Oct. 29, 2011, when Montreal won 4-2.