BOSTON — When you’re scoring in bunches, teams can find different ways to win.

And the Rangers did just that Saturday night, netting their first two shorthanded goals of the season while extending their winning streak to four with a 5-2 win over the Bruins at TD Garden.

Derek Stepan, who had a goal and two assists, scored the first shorthanded goal from in front on a pass from Michael Grabner at 17:59 of the first period to snap a tie at 1. Kevin Hayes scored shorthanded 2:18 into the second period to make it 3-1, beating Tuukka Rask from 15 feet.

Nick Holden had scored in the first period and rookie Pavel Buchnevich put the icing on the cake with a power-play goal at 13:37 of the third. It was his first NHL goal. Grabner made it 5-2 with his seventh goal at 16:48 of the third period.

Stepan said of his first goal of the season: “You always want to contribute and score goals. Winning does help, but it’s always good to get the first one and relax yourself. You don’t know how good that felt.Maybe the six games in World Cup stole my bounces. You look at the balance we have and it helps. That doesn’t make you grip the stick as hard. We’ve got a lot of guys who are playing at a high level.”

Backup goaltender Antti Raanta, named the first star of the game, made 35 saves and won for the third time in three starts. “It’s a tough place to play,’’ he said. “They got an early goal, so you have to be on your toes after that. I made some saves, and a good feeling came from there. It was a challenge for me to play this kind of game: lots of pucks coming from bad angles.’’

advertisement | advertise on newsday

The Rangers (9-3), who have won seven of eight, will host Winnipeg on Sunday night at Madison Square Garden.

Rask had won all six of his previous starts and had been the most valuable player for the Bruins (6-5) with a 1.48 GAA and a .951 save percentage. Scoring has not been the Bruins’ forte: They have only 26 goals in 11 games. The Rangers have scored 50 goals to lead the league.

Bruins center Patrice Bergeron opened the scoring at 3:44 of the first period. He won a right-circle faceoff from Stepan and both Dan Girardi and Ryan McDonagh mishandled the puck behind the net. Stepan lost track of Bergeron, who had drifted low between the circle, and Brad Marchand found him.

The Bruins caused a little chaos with their jump and forechecking in the middle of the first period, but a soft wrister from Holden at the right point tipped off the glove of the Bruins’ David Krejci midway to the net and flew by Rask at 15:09. The assists went to Jimmy Vesey, playing in his hometown for the first time as a Ranger, and Stepan.

Marc Staal went off for tripping at 16:30 and the Bruins spent the entire first minute in the Rangers’ zone, but Grabner finally poked the puck into the neutral zone, went down the right side, slowed, and found Stepan skating hard toward Rask. He knocked away the initial try, but the puck bounced off Stepan’s skate and in at 17:59.

A little luck also was needed. Just before Hayes’ goal, Girardi got a stick on a pass through the slot to Torey Krug, who — with Raanta out of position and flailing — batted the bouncing puck through the crease.

“The difference was our goaltending was better than theirs and our specialty teams got us a goal on the power play and a couple shorthanded,” Rangers coach Alain Vigneault said. “We didn’t play our best game, but we found a way to make a couple plays.”