SUNRISE, Fla. - The Florida Panthers broke out of their scoring slump in a big way.

Aleksander Barkov scored and Roberto Luongo made 21 saves as the Panthers beat the San Jose Sharks 4-1 on Tuesday night to snap a three-game losing streak.

Tomas Fleischmann, Derek MacKenzie and Jimmy Hayes each also scored for Florida. Florida has won six of seven against the Sharks.

The Panthers entered the game ahead of only Buffalo in scoring with 20 in 12 games and had allowed 10 goals over their past two games. But Tuesday they recorded their largest margin of victory this season — each of Florida's first four wins were by one goal. The Panthers hadn't led by more than two goals in any previous game.

"It was our best 60-minute game we put together all year," Panthers coach Gerard Gallant said. "Tonight was a great performance by our group. The guys all competed; there wasn't one guy that was a passenger tonight."

The Panthers defence kept the Sharks away from the net and they entered the third period with just 12 shots.

"We just never established any type of energy in the game; any type of consistent attack," Sharks coach Todd McLellan said.

Joe Thornton scored for the Sharks. Antti Niemi had 26 saves.

"As a team, we weren't pleased with our last couple games," Luongo said. "I'm really happy the way we responded. It was a character win for our boys."

Ahead 2-0, the Panthers stretched their lead on MacKenzie's goal in the second. Niemi blocked a shot by Aaron Ekblad but MacKenzie grabbed the rebound in the slot and wristed it into the net at 6:37. Ekblad, the Panthers' first round pick in the 2014 draft, has six assists and seven points in 13 games, tying him with Jussi Jokinen for the team lead.

Fleischmann, who was benched for Saturday's game, made it 4-0 when he redirected a shot by Shawn Thornton into the net at 3:01 of the third. The goal was Fleischmann's first of the season.

"It was a good win against a good hockey team," Thornton said. "I told (Fleischmann) before the game, 'Just get open, I'll find you.' Everyone came to play tonight and we need everybody to be successful."

The Panthers scored two goals in a span of 1:22 in the first. They also outshot the Sharks 10-5 in what may have been their best period of the season.

Hayes took a nice pass from Vincent Trocheck in the right circle and beat Niemi with a wrist shot at 10:56 to make it 1-0.

Barkov took a pass from behind the net and quickly sneaked the puck behind Niemi from the left side for a 2-0 lead at 12:18.

Joe Thornton's tip-in for the Sharks with 9:25 left in the game made the score 4-1.

"Tonight, for whatever reason, we just didn't seem ready and we should have been," Thornton said. "When you go down 3-0, it's very hard to come back."

NOTES: San Jose played its third game in four days. ... Florida D Dmitri Kulikov is expected to miss two games with a knee injury sustained in Saturday's game against Calgary. ... Panthers players wore camouflage jerseys during warmups to honour military veterans on Veteran's Day. ... Retired Army Brigadier General Pete Dawkins, the 1958 Heisman Trophy winner, dropped the ceremonial first puck.