BOSTON — For one night, the Boston Bruins figured out a way to win on home ice.

Right winger David Pastrnak scored two goals, including one on a penalty shot, and Tuukka Rask stopped a season-high 41 shots to power the Bruins to a 5-1 victory over the Pittsburgh Penguins on Wednesday night.

The win raised the Bruins’ home record to just 13-15-3 (they’re 20-7-3 on the road) and came after the club surrendered 15 goals in two previous home games. It was the first regulation home victory since Jan. 16 after going 2-4-1 in the past seven home games.

The Bruins swept the three-game season series from the Penguins with a 14-3 goals advantage. The two teams are battling for Eastern Conference playoff position.

Pastrnak, 19, became the young Bruins player to score on a penalty shot when he beat Penguins goaltender Marc-Andre Fleury in the first period. He scored again in the second period (and finished with seven shots on goal).

Right wingers Jimmy Hayes and Landon Ferraro and left winger Brad Marchand scored in as 4:53 span of the third period for Boston, breaking open a close game. Marchand’s goal was his 31st of the season.

Rookie right winger Tom Kuhnhackl scored for Pittsburgh in the second period, cutting a two-goal deficit in half.

Rask raised his record for the season to 23-17-5. He is 6-2 in his last eight decisions.

Ferraro scored on a breakaway for his first goal in his last 30 games since Dec. 9 and Marchand came through with his 15th goal in the last 17 games.

Fleury made 24 saves and fell to 24-14-6.

The Bruins got on the board four minutes into the first period when Pastrnak was awarded a penalty shot.

The penalty shot, the first of Pastrnak’s young career, was the third in as many tries for the Bruins this season — Marchand converted the other. The rest of the NHL, not counting other games Wednesday night, was just 13 of 47.

Center David Krejci lofted a high pass into the Pittsburgh zone that Pastrnak caught on the move. He was slashed across the right leg by Penguins defenseman Derrick Pouliot and got a shot off that was stopped by Fleury. The goalie couldn’t stop the penalty shot, however, and Pastrnak had his first goal in seven games.

Pastrnak made it 2-0 at 3:12 of the second, with Penguins defenseman Olli Maatta passing the puck right to him from behind the net. Pastrnak patiently worked his way around Fleury and slid the puck home for his eighth of the season.

It took the Penguins 55 seconds to get that goal back, with Kuhnhackl directing a rebound of a flip shot by Pittsburgh center Oscar Lundqvist into the goal with his skates as he was stopping.

The goal, which made it 2-1, held up under league review and Kuhnhackl had the second goal of his 19-game NHL career — and Lundqvist picked up his first point in 10 NHL games.

NOTES: Pittsburgh C Evgeni Malkin (lower body) missed his 10th consecutive game, and C Nick Bonino (hand) missed his 17th straight, but coach Mike Sullivan hopes to have both back in the lineup Saturday for a home game against the Winnipeg Jets. … LW Loui Eriksson, who has been on a tear but may also be on the trade block with his contract ending after the season, is the only Bruin to play in all 61 games this season. Boston is the only team in the league with only one player missing just one game. … Penguins D Steve Oleksy, recalled from AHL Wilkes-Barre/Scranton, did not dress for the game. … The Bruins visit the Carolina Hurricanes on Friday night and then play their next four in Boston, which could be a problem for a team that has played so poorly at home.