Joonas Donskoi broke a tie with his second goal early in the third period, and the San Jose Sharks blew a three-goal lead before rallying to wrap up their first-round playoff series with a 6-3 victory over the Los Angeles Kings in Game 5 on Friday night.

Chris Tierney and Matt Nieto scored early goals and Joe Pavelski got another late score for the Sharks, who stared down the demons of their past playoff failures against Los Angeles and advanced to the second round for just the second time since 2011.

San Jose led 3-0 early in the second period before the Kings scored three goals in nine electric minutes. But after Donskoi broke the tie with the second playoff goal of his rookie season, Pavelski added his fifth goal of the series.

Martin Jones made 19 saves and Melker Karlsson added an empty-net goal for the Sharks, who will next face the winner of the Anaheim Ducks' series with the Nashville Predators. The clubs are even heading to Game 5 in Anaheim on Saturday.

Anze Kopitar, Jeff Carter and Kris Versteeg scored for the Kings, and Jonathan Quick stopped 22 shots while losing to his former backup again.

After eliminating the Sharks in 2013 and 2014, the Kings won only Game 3 in overtime in this series. Their run at a third Stanley Cup title in five years ended abruptly, with losses in all three of their home playoff games.

The Sharks had to overcome more than the current Kings. They have an unpleasant history against their downstate rivals, who rallied from an 0-3 series deficit to eliminate San Jose in humiliating fashion in 2014.

Donskoi is a rookie who wasn't around for that flop, and he calmly came through on a rebound with 16:02 to play, turning back the Kings' momentum in the sold-out Staples Center.

Logan Couture and Brent Burns had three assists apiece for the Sharks, whose long history of playoff shortcomings was interrupted last season when they missed the postseason entirely. They've returned under new coach Peter DeBoer with persistence and tenacity.

The loss was a disheartening finish for the playoff-tested Kings, who won two titles and 10 postseason series from 2012-14. After missing the playoffs entirely last spring, Los Angeles returned with renewed energy and reigned atop the Pacific Division for most of this season, but blew the division title in its final home game before getting thoroughly outclassed by the Sharks.

After losing the series' first two home games and splitting on the road, the Kings ostensibly were the desperate team, but they fell behind just 68 seconds into Game 5.

Donskoi and Tierney scored on wide-open shots from the slot, and Nieto made it 3-0 early in the second period. The lead could have been even bigger, but the Sharks failed to score during a 5-on-3 advantage for 1:45, and Patrick Marleau couldn't score on a penalty shot.

The Kings finally awoke when Drew Doughty's shot ricocheted off Dwight King and Kopitar midway through the second. Carter got his second goal of the series a few minutes later, and Versteeg tied it with his first playoff goal for his new team, batting home a rebound of Kyle Clifford's shot off the post.

NOTES: The game might have been the last in the NHL career of Vincent Lecavalier, the former No. 1 pick and Richard Trophy winner who has said he will retire this summer. Lecavalier, who turned 36 years old Thursday, has been largely outstanding after a midseason trade from Philadelphia to Los Angeles, leading to speculation he might consider returning for an 18th NHL season. ... 2014 playoff hero Alec Martinez missed his fourth straight game of the series with an undisclosed injury.