Just when it seemed as if Vancouver would have another third-period collapse against San Jose, Dan Hamhuis and Jacob Markstrom rescued the Canucks.

Hamhuis scored Vancouver's third power-play goal midway through the third period just minutes after Markstrom preserved a tie with a brilliant glove save that helped the Canucks beat the Sharks 4-2 on Saturday night.

"We've seen that before in the last couple of games against these guys," said Alexandre Burrows, who sealed the win with an empty-net goal. "I thought we stayed pretty composed. We said keep battling and we might get a break. We were able to make a nice play on the power play."

Linden Vey and Daniel Sedin also scored power-play goals for the Canucks, who had blown two third-period leads to the Sharks the past week before coming up with key plays late in this game.

Markstrom made 32 saves, including highlight-reel stops against Tomas Hertl and Patrick Marleau in the third to help Vancouver win its fifth straight in San Jose.

Michael Haley and Brent Burns scored for the Sharks, who fell six points behind first-place Anaheim in the Pacific Division. James Reimer made 22 saves in his San Jose debut but was hurt by San Jose giving up seven power-play chances.

"We got that first goal and then we started to take a lot of penalties," captain Joe Pavelski said. "A lot of soft ones, too. It was everybody tonight. It was one of those nights that we couldn't stay out of the box."

The Canucks lost star Henrik Sedin to an upper-body injury in the first period. Sedin got tangled up with Burns during a power play early in the first and fell to the ice. After being helped off by trainers, Sedin returned to play four more shifts before leaving again late in the first and not returning. He is not expected to play Monday.

After rallying from deficits after two periods to beat the Canucks twice in Vancouver the past week, the Sharks came back again in the third when Burns beat Markstrom with a wrister from the slot off a pass from Joe Thornton to make it 2-2 early in the period.

Markstrom had robbed Hertl earlier in the period with a shoulder save and then did it again with a glove save against Marleau during a delayed penalty to keep the score tied at 2.

"It's a desperation save," Markstrom said. "It was a good pass. I didn't expect him to be there. Obviously they had the delayed penalty, so there were six guys on the ice. I kind of forgot about him and sometimes those go in and sometimes those go right in the glove."

Joonas Donskoi then got called for a trip late in San Jose's power play and the Canucks made San Jose pay when Bo Horvat slid a pass to an open Hamhuis, who knocked it into the open net for his first goal of the season.

"It's been a while," Hamhuis said. "Certainly had my chances over the year. It was nice to get one to go in, especially one that made such a big difference in the game."