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 27 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."

Dallas played with 11 forwards and six defensemen after center Matt Duchene sustained a lower-body injury during warmups. The Stars also were without three of their top six defenseman: Miro Heiskanen missed the game to attend the birth of his child, and Jani Hakanpaa (upper body) and Nils Lundqvist (upper body) are injured.

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. Johnston has six points (three goals, three assists) during a three-game point streak.

"I think that's one of the things that sticks out here is everyone kind of stays level," Dallas defenseman Alexander Petrovic said. "No one's freaking out or going nuts. It's a hockey game. Things happen quick."

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

Lindell gave the Stars a 3-2 lead at 10:44 of the third period, keeping the puck on a 2-on-1 rush and scoring from the right side.

"Kind of disappointing," Lindell said. "We had some chances to put the game away and walk away with two points, but it didn't happen. Now just quick regroup and be ready for tomorrow [at the New York Rangers]."

NOTES: Petrovic and defenseman Derrick Pouliot were recalled from Texas of the American Hockey League on Monday. Petrovic played 12:52 in his season debut and Pouliot played 13:52 in his first game with the Stars. ... DeBoer did not have any updates on the injured players after the game but said he hopes one or more is ready to play Tuesday. … Harley had an assist to reach 40 points (15 goals, 25 assists) in his 93rd game, becoming the fourth-fastest defenseman in Stars/Minnesota North Stars history to hit that milestone, behind Brad Maxwell (64 games), John Klingberg (65) and Craig Hartsburg (69). … 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.