BUFFALO —Perhaps there was as much relief as there was joy when the puck finally crossed the goal line. After 53 minutes of mostly uninspired hockey Sunday night, of hockey that mimicked the previous day’s effort against Philadelphia, the Bruins’ top line proved its worth.

David Krejci put home a rebound after Nathan Horton had taken two shots at Buffalo goalie Ryan Miller, giving Boston a 1-0 lead. It was significant, given that the Bruins had lost five of their previous seven games, and had acknowledged their lack of consistency and urgency as the regular season winds down.

And less than three minutes later, the line did it again, with Horton knocking home a perfectly placed pass from Krejci, extending Horton’s goal-scoring streak to three games and giving the Bruins a 2-0 win over the Sabres at First Niagara Center.

“We’ve been losing lots of games lately, so we know we’re not going to be winning hockey games by four-plus goals, so we’ve got to grind it out,” Krejci said. “Two points are huge.”

The final stretch was far different than the rest of the game. And different than the Bruins had been playing of late.

“It was better, absolutely,” coach Claude Julien said. “To call it a step forward, we’ll probably see more of that next time. But the effort tonight, much better. We were skating better; you could see the speed of our game was a lot better than it has been in a long time. We did a great job of forechecking.

“We got better in all areas as the game went on.”

Something had changed seven minutes into the third period, when the Bruins finally found their stride after a lackluster first two periods. That was when the second line of Brad Marchand, Patrice Bergeron, and Tyler Seguin managed Boston’s first shot of the period, borne of a good shift and producing a turn in the team’s fortunes.

“As of late, when things haven’t really been going for us, we’ve kind of gotten frustrated and let it get the better of us,” Milan Lucic said. “But today we tried to stay positive and stick with the game plan and stay patient, and it worked out for us.”

As Julien said, the goal Sunday night was to have a decent start and to get better as the game went on. The start was, well, a bit frightening for the Bruins — though not disastrous thanks to some impressive work from goalie Anton Khudobin (26 saves) — but they did get better as the clock ticked down.

“After the second period, we needed more net-front presence and better net drive,” Julien said. “And I think when you look at the goals, that’s what happened. We went to the net, got some loose pucks. That’s what we needed to do.”

Lucic had emphasized earlier in the day that the Bruins needed to get some traffic around the goalmouth.

“As the game went on, it just felt like the way we were playing defensively it started turning into more offensive chances, and we were able to establish battles in the offensive zone through our forecheck and eventually end up winning some battles in the offensive zone,” Lucic said.

But they were only able to do that because of some game-saving work by Khudobin, especially in the first period. With 10:55 gone in the first, the Sabres had a two-on-one that looked ominous.

Khudobin, though, managed a pad save to rob Tyler Ennis, and the game remained scoreless. It might have been the game’s critical moment.

“[It] just kind of gave us some life,” Julien said. “All of a sudden, we just kind of picked up our game. I thought we got better from that point on. He was on top of his game tonight.”

The hosts had other chances, too. All of them were turned back by Khudobin, who combined with an impressive penalty kill to keep the Sabres off the board, including on back-to-back penalties in the second.

“It was unbelievable,” said defenseman Matt Bartkowski, who got his first career point on the Bruins’ first goal. “The first 10 minutes, we wouldn’t have won the game if he didn’t play that well. They should have had three or four goals, definitely.”

But they didn’t, and so the Bruins were able to remain patient before picking up their game at just the right time.

“As the game went on, we started getting more and more solid, more and more consistent,” Bartkowski said. “It finally paid off in the third.”