Edmonton won the best-of-7 series 4-2 and will play the Anaheim Ducks in the second round.

SAN JOSE -- The Edmonton Oilers hung on for a series-ending 3-1 victory against the San Jose Sharks in Game 6 of the Western Conference First Round at SAP Center on Saturday.

[WATCH: All Oilers vs. Sharks highlights | RELATED: Complete Edmonton vs. San Jose series coverage]

Leon Draisaitl and Anton Slepyshev each scored his first Stanley Cup Playoff goal early in the second period, Connor McDavid scored into an empty net with less than a second left, and Cam Talbot made 27 saves for the Oilers, who won a postseason series for the first time since advancing to the 2006 Cup Final.

"It takes work, it takes lessons, it takes repetition in practice, it takes pain," Oilers coach Todd McLellan said. "It doesn't come easy, and for our team, we're watching them grow up right in front of us, which is a great thing. We've been through a push into the playoffs. We're through a round now. We learned how intense it is to close out a game.

"We learned how to respond after a blowout (a 7-0 loss in Game 4), we learned to manage ourselves throughout a series. We played in a hostile environment. So that's great to this point. And that's just the first round. It gets tougher as it goes."

Patrick Marleau scored, and goalie Martin Jones made 18 saves for the Sharks, who made it to the Cup Final for the first time in their history last season.

Video: EDM@SJS, Gm6: McDavid sends a backhand into empty net

"The way hockey is sometimes, you get on that roll," Sharks center Joe Thornton said. "And this year the injury bug kind of hit us and it kind of hurt us. But no excuses. They played a great series, and hats off to them."

Draisaitl scored 54 seconds into the second period to put the Oilers ahead 1-0. He got behind the Sharks defense to take a stretch pass from Adam Larsson, fended off defenseman Justin Braun, and beat Jones.

Less than a minute later, Slepyshev scored unassisted on a breakaway when he shot past Jones' blocker to make it 2-0 at 1:50.

Marleau scored from the left of the Oilers net off a pass from Logan Couture through the slot at 12:12 of the third period to get the Sharks within 2-1. It was his third goal of the series, 68th in the NHL playoffs in his career.

Edmonton killed a San Jose power play after being penalized for too many men on the ice with 4:57 remaining. Sharks forward Joe Pavelski beat Talbot with a backhand but hit the crossbar with 3:46 left.

"It was definitely nerve-wracking, but I think we stayed composed and disciplined in our game, especially in our penalty kill," Oilers forward Milan Lucic said. "[Talbot] made some huge saves for us. They got some tips and some bounces in front, and we were able to get some saves and not allow some second opportunities.

"Definitely made it a little bit harder on ourselves, but you knew they were going to push and fight for their lives, but at the end of the day, this one feels good."

Edmonton defenseman Oscar Klefbom did not play in the third period because of an illness. Several Oilers, including Draisaitl, have had the flu.

Video: EDM@SJS, Gm6: Coach McLellan on the lessons learned

Goal of the game

Klefbom started the play that led to Draisaitl's goal when he blocked San Jose defenseman Justin Braun's shot from the right point. Larsson got the puck and sent it ahead to Draisaitl, who had a step on Braun and beat Jones through the five-hole.

Video: EDM@SJS, Gm6: Draisaitl goes five-hole on break

Save of the game

Marleau cut through the slot on a short breakaway for a backhand from close range, but Talbot made a left-pad save at 2:42 of the second period. "I was just trying to stay patient, and when he made the move, I tried to get a good push across because he's so quick, he can beat you back there pretty quick," Talbot said.

Video: EDM@SJS, Gm6: Talbot makes toe save to deny Marleau

Unsung performance of the game

Sharks defenseman Brent Burns had six shots on goal, 13 shot attempts and six hits, each a game high.

Highlight of the game

Slepyshev quickly got to a loose puck in the neutral zone after Chris Tierney's errant pass went off defenseman Paul Martin's outstretched stick at the right point near the Oilers blue line, and then beat Jones with a snap shot from close range.

Video: EDM@SJS, Gm6: Slepyshev nets wrister on breakaway

They said it

"It's tough to be up two and give up a goal with seven minutes left. That's stressful. I think we're a little bit more mature than people give us credit for, and I think we showed that tonight." -- Oilers captain Connor McDavid

"I knew we had to control McDavid, and we did. Our guys did a fantastic job of trying to limit his time and space. Their depth guys found some goals ... We did that last year on our playoff run." -- Sharks coach Peter DeBoer

Video: EDM@SJS, Gm6: DeBoer on tough series loss vs. Oilers

Need to know

Jordan Eberle led the Oilers with four shots and had three hits. … After being a healthy scratch for Game 5, Sharks forward Joonas Donskoi returned to the lineup, replacing Timo Meier. Donskoi had an assist and one shot on goal in 12:31.

What's next

Oilers: Game 1 of Western Conference Second Round against Anaheim Ducks (TBD)

Sharks: Season over

Video: Draisaitl, Slepyshev lead Oilers to 3-1 win in Game 6