SUNRISE, Fla. -- Pavel Zacha scored the go-ahead goal with 2:21 remaining in the third period, and the Boston Bruins rallied for a 4-3 win against the Florida Panthers at Amerant Bank Arena on Tuesday.

David Pastrnak’s pass deflected in off Zacha’s skate at the left side of the net. The goal came after Trent Frederic tied it 3-3 at 15:38 while on a power play.

“In three weeks, this goes to another level,” Boston coach Jim Montgomery said, referring to the Stanley Cup Playoffs. “I liked the way our team kept competing. We battled for each other, we were in every battle. All five guys stuck together, and that’s what we need.”

Zacha, Pastrnak and Charlie McAvoy each had a goal and an assist for Boston (42-16-15), which took sole possession of first place in the Atlantic Division over Florida (46-21-5), which is two points back with one game in hand.

Jeremy Swayman made 19 saves for the Bruins, who had lost two in a row.

“This was special, a real momentum-builder for us,” Swayman said. “It prepares us for what to expect, the next nine games plus the playoffs. That’s a really good team and this gives us a boatload of confidence moving forward in what we need to do to prepare ourself for the playoffs.”

BOS@FLA: Zacha deflects it in to grab the lead

Evan Rodrigues, Sam Reinhart and Carter Verhaeghe scored, and Sergei Bobrovsky made 17 saves for the Panthers, who are 1-4-1 in their past six games.

Rodrigues gave Florida a 1-0 lead 27 seconds into the first period, putting in a loose puck in the crease after Aleksander Barkov’s shot from a sharp angle went off Swayman’s pad.

Barkov, the captain and top-line center for the Panthers, returned after missing three games with a lower-body injury.

“We battled hard, they battled hard and it was a tight game all the way through,” Barkov said. “We definitely can learn from this. We played the right way for most of the game.”

BOS@FLA: Rodrigues kicks off scoring 27 seconds in

Boston tied it 1-1 at 17:43 when McAvoy one-timed a cross-ice feed from Matt Grzelcyk in the right circle.

Florida took a 2-1 lead at 18:56 when Reinhart scored in front off Eetu Luostarinen’s cross-crease pass through traffic. The goal was Reinhart’s 51st of the season and third in the past two games.

Pastrnak tied it 2-2 at 15:59 of the second period after McAvoy found him open at the left side of the net with a pass from the right wall. The goal was Pastrnak’s 100th point of the season. 

“It was an important win for us,” Zacha said. “We know that’s a really good team and it was like a playoff game. Winning those is really important to build [our] game moving forward.”

BOS@FLA: Pastrnak puts it home in front to even the score

Verhaeghe put Florida back in front 3-2 at 9:53 of the third period with a shot from the left circle on an odd-man rush.

“We lost the game and it’s frustrating, but it was good to get into a game like that,” Verhaeghe said. “It was intense, it was a hard-fought battle, but we obviously did this in New York (against the Rangers in a 4-3 shootout loss Saturday) where we had a one-goal lead (late in the third). We need to find a way to protect it. Good learning experience for us.”

The Panthers were playing their fourth game in six days.

“It was a really good hockey game, and you want to win it, especially when you get the lead like that,” Florida coach Paul Maurice said. “You want to close it out, but sometimes suffering a bit is good. Sometimes it’s good to put that much effort in and get nothing. I am not going to complain about the game. That was as good a game that we have been part of this year in terms of speed and physicality.”

NOTES: Pastrnak (45 goals, 56 assists) became the fifth player in Bruins history to have consecutive 100-point seasons. He joined Bobby Orr (six), Phil Esposito (five), Adam Oates (two) and Barry Pederson (two). Pastrnak had 113 points (61 goals, 52 assists) last season. … McAvoy reached the 10-goal mark for the second time in his NHL career (10 in 2021-22). … Reinhart is eight goals from tying Pavel Bure (59 in 2000-01) for the most in a season in Panthers history. Florida has 10 games remaining.