DENVER (AP) – The Colorado Avalanche looked unstoppable early and shaky down the stretch in nearly blowing a big lead.

Bottom line: The streak goes on.

Nathan MacKinnon scored twice during a 58-second span in the first period, Matt Nieto added a late insurance goal and the Avalanche won their eighth straight by holding off the San Jose Sharks 5-3 on Thursday night.

Carl Soderberg also scored, while Mikko Rantanen had a goal and two assists for the Avs, who’ve won eight in a row for the first time since the 2005-06 season. It’s tied for the third-longest streak in franchise history.

Even more, Colorado has never trailed during the stretch and has outscored teams by a 34-13 margin.

“We are earning what we get right now,” MacKinnon said. “We are playing some good hockey and we are a good team.

PHOTO GALLERY: Avalanche 5, Sharks 3

“We know we aren’t going to win every game – we could lose two or three in a row. But this is a good foundation for us to realize how we are going to win. We’re not just lucky, winning eight straight. There is a reason why. So when some adversity comes in, we can look back on this.”

What looked like a cakewalk turned into anything but with Colorado nearly squandering a 4-0 advantage. The Sharks sliced the deficit to a goal when Joe Thornton scored early in the third period. Nieto sealed the win with a goal against his former team with 3:14 remaining. The Sharks pulled goaltender Martin Jones for around 3 minutes, but couldn’t score.

Timo Meier and Marc-Edouard Vlasic also had goals for San Jose.

Jonathan Bernier stopped 45 shots to run his winning streak to a career-best seven games. He’s filling in with starter Semyon Varlamov sidelined by a lower-body injury.

Bernier made a big save on a power play in the third period, when he just stuck out his left pad to thwart Tomas Hertl , who had several opportunities to tie up the game.

“I should score like five goals. The goalie owned me today,” Hertl said. “It’s a little bit on me, because the chances were there. I should put it in. They should be goals.”

Still, the Sharks showed some late spunk, which pleased their coach.

“You don’t get points in the standings for that, but we’ve got a group that doesn’t lay down in those situations,” Sharks coach Peter DeBoer said. “We take a lot of pride in that.”

Colorado weathered seven penalties and was outshot by San Jose 48-22.

“You can’t play a perfect game, you have to learn from it,” Bernier said. “We’re happy to get this thing rolling.”

Speaking of rolling, the line of Rantanen, Gabriel Landeskog and MacKinnon combined for three goals and four assists.

There’s no place quite like Pepsi Center for MacKinnon, who leads the league in scoring at home with 44 points (17 goals, 27 assists) in 25 games. He put the Avalanche up early in the first period when he sent a wrist shot through the legs of Vlasic and through the pads of Jones.

He added another on a slap shot that ticked off Jones’ glove and went in. MacKinnon also was credited with an assist on a goal in the second period that hit Rantanen off and bounced in. It gave Colorado a 4-0 lead.

There was a scary moment in the second when Soderberg took a skate to the neck when he fell to the ice. He headed to the bench and into the dressing room to get about five stitches. He returned later in the second.

“I’m OK,” Soderberg said.

NOTES: The Sharks are in a stretch during which they play 14 of 18 games on the road. … This was the first of three meetings between San Jose and Colorado. … Avalanche C Tyson Jost (lower body) was out of the lineup, while LW J.T. Compher (upper body) returned after missing six games. “They’re kind of trading off injuries,” coach Jared Bednar said. … F Sven Andrighetto (lower body) was placed on injured reserve. … Varlamov has resumed skating, Bednar said. … Colorado has scored 92 goals on home ice, the most in the league.

UP NEXT

Sharks: Host Pittsburgh on Saturday.

Avalanche: Wrap up a three-game homestand Saturday against the New York Rangers.

By PAT GRAHAM, AP Sports Writer

(© Copyright 2017 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)