BOSTON -- Charlie McAvoy scored in the ninth round of the shootout and Jeremy Swayman made 43 saves when the Boston Bruins rallied for a 4-3 win against the Dallas Stars at TD Garden on Monday.

Jesper Boqvist had a goal and an assist for Boston (33-12-11), McAvoy had two assists, and Justin Brazeau and David Pastrnak scored. Swayman made eight saves on nine attempts in the shootout for the Bruins, who ended a four-game skid (0-2-2).

"My favorite moments, baby. That's why I play," Swayman said. "It's pretty special. Facing [Stars goalie Jake] Oettinger too. We've got a great friendship, and seeing him just hold the fort down on the other end, you knew you had to rise to the occasion. So just one of those games that you're going to remember for a long time, and I just enjoyed it."

DAL@BOS: McAvoy, Swayman lead Bruins to shootout win

Wyatt Johnston, Ryan Suter and Esa Lindell scored for Dallas (34-14-8), which has lost two in a row (0-0-2) after winning its previous three. Oettinger made 25 saves and stopped seven of nine shots in the shootout.

"It's a tough, tough building to play in, even with a full lineup," Stars coach Peter DeBoer said. "I think we recognize that and we showed up, and we worked and played the right way. [We] did a good job."

Pastrnak tied the game 3-3 at 18:15 of the third period. With Swayman out for an extra attacker, McAvoy passed across the zone to Pastrnak, who scored on a one-timer from the left face-off circle.

"Something has to happen to overcome, to get out of the malaise that we were in, results-wise," Bruins coach Jim Montgomery said. "We got the great effort by our goaltender, and then our 6-on-5, our great players made great plays. It's the time where you need to tie the game."

DAL@BOS: McAvoy sets up Pastrnak for game-tying goal

Boqvist gave the Bruins a 1-0 lead at 4:01 of the first period, scoring in front off Anthony Richard's centering pass.

"It kind of just happened," Boqvist said. "I don't think it's going in if I just one-touch it, so it kind of just happened. It was nice to see that one go in, and first goal here at home too."

Johnston tied it 1-1 at 11:14 when he redirected Thomas Harley's shot. Suter gave the Stars a 2-1 lead at 1:04 of the second period on a shot from the left face-off circle.

The Bruins tied it 2-2 28 seconds later, when Brazeau scored from in front at 1:32. It was the forward's first NHL goal in his first game. He had signed a two-year, two-way contract earlier Monday.

"It's a cool feeling," Brazeau said. "It's been a long time coming for me. I've worked hard to get here, so to see that kind of comes full circle. It feels really good."

DAL@BOS: Brazeau scores his first NHL career goal

NOTES: Bruins defenseman Hampus Lindholm left the game with 14:11 remaining in the third period. Montgomery did not have an update on his status after the game. … Brazeau is the first Bruins player to score in his NHL debut since Marc McLaughlin on March 31, 2022.