ANAHEIM — A strong start. A shaky middle. A jelly-legged third. And a frantic overtime.

After all of that, the Ducks and the cellar-dwelling San Jose Sharks sorted out their final meeting of the season in a shootout, where Mason McTavish was the only player to convert out of the six who tried, claiming a 4-3 victory in the final contest of a five-game homestand that would have been a shame to lose.

Ending with an overtime shootout was not on anyone’s mind at the Honda Center after the Ducks (33-33-8, 74 points) jumped out to a commanding lead in a wide-open first period.

Following a couple of quick early chances, including a breakaway by Carter Gauthier, a redirect from Trevor Zegras at the 2:04 mark put the Ducks ahead on his 10th goal of the year.

Moments earlier, McTavish jammed the puck and Sharks goaltender Alexandar Georgiev over the goal line, wiping out a possible score and prompting a faceoff at the right circle.

McTavish won the faceoff, giving Sam Colangelo a chance to fire it at the net, where Zegras altered the puck’s trajectory with his stick.

For Zegras, the score gave him double-digit goals for the first time since he scored 23 in back-to-back seasons between 2021-2023, leaving him with points in six straight games.

Following an 8-1 shellacking against the Kings at Crypto.com Arena on Sunday, the Sharks (20-44-10, 50 points) showed life at 5:28 when Russian defenseman Shakir Mukhamadullin connected on his second goal in 29 games this year, striking a first-time slap shot from the blue line that trickled through the legs of Ducks goaltender Lukas Dostal.

Playing the Ducks for the first time in their final meeting this season, No. 1 overall draft pick Macklin Celebrini went to the penalty box for slashing at 7:01. The worst power play conversion rate in the NHL coming into the night belonged to the Ducks, but Jackson LaCombe’s finish through traffic nudged them above the New York Islanders with eight games to go.

As the 18-year-old Celebrini watched, last year’s No. 2 overall pick Leo Carlsson occupied the slot while Cutter Gauthier clogged things up in front of Georgiev. LaCombe wristed a wobbler at them that snuck past everyone and found the net for his 14th of the season.

The Ducks invited trouble midway through the first after penalties on Olen Zellweger (holding the stick) and Drew Hellson (high stick) were called within 46 seconds of one another, handing the Sharks a two-man advantage.

Inconsistent as their penalty kill has been this year, the Ducks stood tall to retain their momentum. That effort helped them carry a 3-1 edge into the first intermission.

Heavy pressure allowed the Ducks to keep the puck in the offensive zone, where Radko Gudas rifled a pair of slapshots in quick succession. The rebound on his second attempt fell to Colangelo and the hot rookie netted his seventh goal in the last 10 games.

The 3-1 score held up throughout a choppy second period, even as the Sharks fired 14 shots on goal to the Ducks four.

That energy persisted into the third period, especially after the Sharks killed an early 5-on-3 situation.

A short time later, on the edge of the crease Dostal got sideswiped by Sharks forward Collin Graf, who was retaliated against behind the net by Olen Zellweger and Nikit Nesterenko. Officials did not blow the play dead, and San Jose kept their wits making the most of the Ducks confusion.

With three Ducks players standing shoulder to shoulder to the right of Dostal and Jacob Trouba, who returned to the lineup after missing Sunday’s loss to Toronto, effectively screening his goaltender in the slot, Sharks defenseman Marc-Edouard Vlasic picked out the top corner for his first of the year, cutting the score to 3-2.

Alexander Wennberg’s 10th goal of the season tied it up at 16:46.