BOSTON -- David Pastrnak scored a hat trick for the Boston Bruins in a 6-2 win against the Ottawa Senators at TD Garden on Tuesday.

It was Pastrnak’s second hat trick of the season and 17th in the NHL.

“It’s definitely fun when your game is on,” Pastrnak said. “This one feels definitely special because it was two backhanders and a high tip. I don’t get many of those, so it was an interesting one.”

Justin Brazeau scored twice, and Linus Ullmark made 30 saves for Boston (41-14-15), which has won three in a row and seven of its past 10 (7-1-2). Kevin Shattenkirk had three assists.

“We wanted everybody to check, and then if we checked well, we thought that we’d end up with [offensive] zone time,” Bruins coach Jim Montgomery said. “I liked both ends of the ice in the third period.”

OTT@BOS: Pastrnak tallies his 345th goal, notches a hat trick

Brady Tkachuk and Shane Pinto scored, and Joonas Korpisalo made 20 saves for Ottawa (28-35-4), which has lost nine of its past 12 games (3-8-1).

“Whether it’s [Boston’s] top players or their fourth line guys, everybody plays the same exact way,” Senators defenseman Thomas Chabot said. “They don’t give you anything, they don’t give you any room and space to make plays.”

Pastrnak gave the Bruins a 1-0 lead at 8:27 of the first period, tipping in Matt Grzelcyk’s shot from the left point.

Pastrnak then made it 2-0 at 11:23. He intercepted Ottawa forward Tim Stutzle’s centering pass before scoring on a breakaway.

Pinto cut it to 2-1 with a power-play goal at 13:08 of the second period, slipping the puck past Ullmark from the high slot.

“We played really well [defensively], I felt at least,” Ullmark said. “Might be some things here and there that we [weren’t] as crisp with, but at the end of the day, what matters is that you get the win, and I thought that when the third period came, we really shut it down.”

Brazeau pushed it to 3-1 at 18:51, scoring on the power play off the rebound of Shattenkirk’s shot.

“I think that I tried to play simple early on and make sure that I wasn’t trying to think too much and do too much with pucks when I got them," Shattenkirk said.

OTT@BOS: Brazeau buries PPG on a rebound

Tkachuk cut it to 3-2 with four seconds left in the second period, poking in his own rebound on the doorstep.

Pastrnak completed his hat trick with a backhand from the slot to make it 4-2 at 4:43 of the third period, and Jesper Boqvist scored 25 seconds later after skating past Jakob Chychrun to extend the lead to 5-2.

“I thought that we played two good periods of hockey, especially the second period,” Ottawa coach Jacques Martin said. “Getting the goal late in the second, you’d think it would give us the momentum for the third, but it just seemed that wasn’t case. … When they got that fourth goal, it seemed to really take the life out of us.”

Brazeau scored his second power-play goal of the game to make it 6-2 at 18:06. He received a pass from Jake DeBrusk behind the net and curled out front before beating Korpisalo glove side.

Brazeau hadn’t scored since getting a goal in his NHL debut on Feb. 19 against the Dallas Stars.

“It’s a lot of fun. I mean, I never really played too, too much winning hockey,” Brazeau said. “So, it’s really nice to kind of be a part of it and hopefully continue to be a part of it down the stretch here.”

NOTES: Pastrnak’s 17 hat tricks are second in Bruins history, behind Phil Esposito (26). His third goal was his 345th in the NHL, moving him past Cam Neely for seventh in Boston history. … Pastrnak extended his point streak to six games (six goals, three assists). … Stutzle’s six-game point streak (three goals, five assists) ended.