After the Anaheim Ducks fell out of first place in the NHL during a disappointing holiday weekend, coach Bruce Boudreau thought they would benefit from a grind-it-out game against a formidable defensive team.

Thanks to Frederik Andersen’s goaltending, the Ducks barely emerged from that test with a win over the Boston Bruins.

Devante Smith-Pelly scored the tiebreaking goal late in the second period, and Matt Beleskey added his career-best 12th goal in the Ducks’ 3-2 victory Monday night.

Andersen made 32 saves and Sami Vatanen also scored for the Ducks, who reclaimed the Western Conference lead. Anaheim fell out of the league’s top spot last weekend with its first back-to-back regulation losses of the season, but Boudreau thought the Ducks rebounded well, particularly in a gritty third period.

“The league is pretty fast, and when we’re playing our best, it’s down low and on the boards,” Boudreau said. “The third period was our best (period) with a lead in a while.”

Just two days after allowing five goals and getting pulled from a loss at San Jose, Andersen made several big stops in the final two periods as the Ducks barely hung on to their lead. In his 12th consecutive start, the Danish goalie stopped a clean breakaway by Joe Morrow in the second period, and scrambled across his crease repeatedly in the final minutes.

“Freddie was great. Who can figure goalies out?” Boudreau asked.

Brad Marchand and Simon Gagne scored for the Bruins, who have lost three of four.

Tuukka Rask stopped 25 shots as Boston opened a tough four-game Pacific Division road swing without injured veterans David Krejci and captain Zdeno Chara, who didn’t make the trip.

“I’m certainly not going to criticize the effort,” Boston coach Claude Julien said. “I thought we played hard, and I really feel like we should have won that game. If you take the whole 60 minutes, I felt we were the better team.”

Rask thought Boston dominated play except in the minutes surrounding the second intermission.

“We had 50 minutes of really good hockey, but that first part of the third was not so good,” Rask said. “If you make turnovers, they’re going to cost you, and we never rebounded.”

After a scoreless first period, Marchand was left alone in the slot moments after a Bruins power play ended midway through the second. But just 57 seconds after Marchand’s first goal since Nov. 4, Vatanen carried the puck into Boston’s zone and crashed the net, knocking home Patrick Maroon’s rebound.

In his first full NHL season, Vatanen has been responsible for most of the Ducks’ offense from the blue line. The Finnish Olympian has six goals, while the other 11 defensemen who have played for injury-plagued Anaheim this season have five combined goals.

Anaheim took the lead with 22 seconds left in the second when Smith-Pelly and Andrew Cogliano created huge traffic in front of Rask. Smith-Pelly reached out for a fortunate tip on Jakob Silfverberg’s shot for his first goal in 13 games since Oct. 28.

After Ryan Getzlaf won a faceoff early in the third, Beleskey increased the Ducks’ lead with a nasty wrist shot between two Bruins and into Rask’s far top corner.

“I’m getting lots of good looks and just trying to get shots through,” said Beleskey, who surpassed his previous single-season high in goals after just 26 games.

Gagne trimmed the lead with a redirection goal with 9:40 to play, his first in 18 games since Oct. 16.

NOTES: Newly acquired D Eric Brewer made his home debut for the Ducks, playing 21:15. Anaheim has five injured defensemen, and the club traded Bryan Allen to Montreal last week. … Beleskey is tied for sixth in the league in goals. … Boston scratched rookie Seth Griffith for just the second time in 18 games.

Join our Newsletter for the latest news right to your inbox