The Bruins allowed an average of 39 shots on net during their just completed three-game western Canada road trip and anyone who has watched this team over the last decade-plus will tell you that that is not exactly vintage Bruins hockey.

But it’s amazing what you can accomplish when get some good goaltending.

Linus Ullmark — suddenly looking worthy of the four-year, $20 million contract he signed in the summer — made 40 saves and the B’s got some timely goals to beat the Calgary Flames, 4-2, in the Saddledome on Saturday night. The victory gave the B’s five of a possible six points on the road trip and put them into a playoff spot for the first time all season.

Assistant coach Joe Sacco, running the bench for head coach Bruce Cassidy (COVID protocol), was rightfully pleased with the team’s competitiveness and obviously the results of the trip, even while fully acknowledging the method to gain the points was not ideal.

While they did not spend a ton of time in the Calgary zone, they got contributions throughout the lineup. There were two goals from the back end (Connor Clifton and Charlie McAvoy), a first line goal (Brad Marchand) and a fourth line tally (Curtis Lazar) that came in the third period to dampen the Flames’ hopes of a comeback. Trent Frederic, starting to look more and more comfortable in his natural center position, picked up a pair of helpers.

For as many shots as they allowed on this trip, they did not give up a 5-on-5 goal in the three games until a Sean Monahan skate redirection with 1:36 left in what was essentially garbage time.

But the story line of the trip was the goaltending. With the possible return of Tuukka Rask hovering over the Ullmark-Jeremy Swayman tandem, both netminders have found their groove at an opportune time for both them and the B’s.

Ullmark, who has now made 81 saves in his last two starts, is 4-1 in his last five starts with a .941 save percentage. Swayman meanwhile has bumped up his save percentage to .922 and brought his goals against average down to 2.15.

There’s nothing like competition to get the best out of players.

“First of all, it’s always fun to practice with Jeremy. He pushes me to become a better goaltender every day,” said Ullmark. “He goes out there and plays his heart out. It doesn’t matter if it’s 7 o’clock in the morning or whatever it is or on a back-to-back. He always goes and tries his best. And that keeps me motivated and it keeps me on my toes and I know if I ever have a couple of rough starts, he’s going to pick up the torch and keep playing for us. He’s a terrific goaltender. Obviously there’s a lot of friendship going on there, but there’s a lot of pride. We always want to play every night. But whenever there’s an opportunity for the other guy to play, the other guy is always very supportive.”

The B’s suffered perhaps their most discouraging loss of the season at the Garden on November 21 at the hands of the Flames, a 4-0 drubbing in which quality scoring chances were hard to find. The first period on Saturday at times looked like an extension of that game. The Flames held a 15-7 shot advantage, which aligned with their territorial edge. But the B’s managed to escape the first 20 minutes with a 1-0 lead.

The fourth line of Anton Blidh, Frederic and Lazar had a couple of high energy shifts in the first and it was that line’s breakout that led to the B’s first goal. From the left wing in the neutral zone, Blidh hit Frederic with a pass and once the centerman gained the blue line, Frederic dished it to a diving down Clifton. Seeming to catch goalie Jacob Markstrom by surprise, Clifton beat Markstrom with a high shortside shot at 2:17. It was good initiative by Clifton, and not a good goal allowed by Markstrom.

The Flames continued their attack early in the second period and at one point were outshooting the 22-7, thanks in part to one of their five power-plays.

But just when it looked like the B’s were about to get steamrolled, they scored twice in 56 seconds. First Marchand doubled the B’s lead at 5:52, tipping home a David Pastrnak shot just before a line change.

Less than a minute later, they were up 3-0. Patrice Bergeron gathered a loose puck behind the Calgary net and centered a pass that went through to Charlie McAvoy out high and, with room in front of him, skated in and snapped his fourth of the year over Markstrom’s blocker. It was Bergeron’s 554th career assist, pushing him ahead of Phil Esposito for fourth place on the Bruins’ all-time list.

The Flames got one back before the period was over. Blidh got called for slashing on a backcheck and, on the power-play, Matthew Tkachuk scored off a Rasmus Andersson shot at 12:19.

But before the Flames could make their third period push that everyone expected, Lazar got the B’s their three-goal lead back on a goal powered by Frederic. Frederic took a shot that Markstrom stopped, then circled the net to collect the rebound and fired another shot that produced a room-service rebound for Lazar at the top of the crease to make it 4-1 at 2:57 of the third.

The Flames could never truly recover. And the B’s had themselves a very successful road trip, warts and all.