BUFFALO, N.Y. – Bruins goalie Anton Khudobin was both good and fortunate in stopping every shot he faced, giving Boston’s sputtering offense time to finally figure out a way to beat Ryan Miller.

Khudobin made 26 saves — including reaching out with his stick to prevent Buffalo’s Patrick Kaleta from scoring into an open net — to earn his second career shutout. David Krejci and Nathan Horton each had a goal and assist in the final 7:06 of a 2-0 win over the Sabres on Sunday night.

Though scoring is still an issue for a team that’s been held to two or fewer goals in regulation in seven of its last eight outings, Coach Claude Julien saw signs of progress.

“It was better, absolutely. And I think we’re going to call it a step forward,” Julien said. “The effort tonight was much better. We’re skating better.”

Boston won for only the third time in eight games (3-4-1), while improving to 2-5 in its last seven road games. The Bruins (22-8-4) closed to within a point of Northeast Division-leading Montreal.

The Sabres, meanwhile, continue to head in the other direction. In dropping to 0-2-2 in their last four, Buffalo (13-17-6) fell into 13th place in the Eastern Conference.

With starter Tuukka Rask getting a rest, Khudobin was the difference for a Bruins team that had allowed opponents to score the first two goals in each of the previous four games.

“To start off, ‘Dobi’ made some huge saves for us, especially early in the first period,” Bruins forward Milan Lucic said. “And that kind of kept the momentum on our side.”

There was Khudobin’s stick save on Kaleta three minutes in. After misplaying the puck behind his own net, Khudobin stuck out his stick in desperation to get a piece of Kaleta’s shot.

“I got lucky that I didn’t get scored on, because it wouldn’t be good at all,” Khudobin said.

He was much better some eight minutes later, when he kicked out his right pad to foil Tyler Ennis alone in front.

“Oh yeah, that was an interesting save. I just felt under my right pad the puck, and didn’t know where it goes,” Khudobin said. “But a save’s a save.”

The Bruins finally cashed in on their few chances by getting to the front of the net.

Krejci opened the scoring during a scramble in front with 7:06 remaining, after Horton was stopped twice by Miller. Krejci then returned the favor by setting up Horton for an easy tap-in in front with 4:16 left.

Miller finished with 29 saves. He appeared in his 491st career game, matching the Sabres record for goalies set by Dominik Hasek.