GLENDALE, Ariz. - The game plan was to get shots on goal, so that's just what Brenden Dillon did.

It came from along the boards near the blue line, wasn't a particularly hard shot and was probably going wide, yet found its way into the net.

After a long scoring drought like his, Dillon was happy to see anything go in, even if it was on a lucky bounce.

Dillon scored his first goal in 62 games early in the third period and Antti Niemi stopped 27 shots, lifting the San Jose Sharks to a 3-2 win over the Arizona Coyotes on Tuesday night.

"I've had a couple of those bounces like that go against us this year, so to get one go for us — and for me personally — and get the win, I'm really excited," Dillon said.

Coming off a disappointing loss to the New York Rangers, the Sharks were solid at both ends.

Joe Pavelski scored his 22nd goal early in the second period and Tomas Hertl put one in just over a minute later, sending the Sharks into the third period tied at 2-all.

Dillon put San Jose up 3-2 early in the third period with a shot that caromed off the skate of Coyotes defenceman Zbynek Michalek and squeezed through Devan Dubnyk's pads.

Niemi closed it out, making some big saves down the stretch to give the Sharks a victory before opening a seven-game homestand.

"It was a pretty evenly-played game, but we'll take the bounce that went our way and move on," Sharks coach Todd McLellan said.

The Coyotes were right there with the Sharks, playing solidly after a disappointing loss in their last game.

Arizona created some good chances, with Mikkel Boedker scoring in his third straight game and Shane Doan adding a goal before sitting out most of the third period with a right leg injury.

Dubnyk was steady, stopping 22 shots, yet Arizona still came away with its fourth loss in six games, thanks, in large part, to an unfortunate bounce.

"Things are just bouncing the wrong way for us right now," Boedker said. "That's just the way it goes and we've got to keep working at it, keeping doing the things we're doing and getting chances. We do that and things will start falling for us."

After a superb stretch in December, the Sharks hit a bit of a slump, losing six of nine games.

San Jose has struggled to score at times during its funk, scoring two or fewer goals five times. The return of Joe Thornton after four-game absence during to a shoulder injury did little to spark the Sharks against the New York Rangers on Saturday, leading to a 2-1 loss.

Arizona figured to be a nice remedy for San Jose.

Despite being built upon defence, the Coyotes have struggled in their own end all season, entering Tuesday's game 28th in goals-against in the NHL, allowing 3.31 per game. Arizona had blowup games twice in the last three games, allowing 11 goals in a pair of losses wrapped around a 4-1 win over Winnipeg.

The Sharks had some good scoring chances in the first period, but didn't score.

The Coyotes also generated some good opportunities and did score late, when Boedker faked a shot then beat Niemi with a slap shot for his fourth goal in three games.

Once the second period revved up, so did San Jose's offence.

Pavelski tied it 30 seconds into the period on a power play, a wrister from the right faceoff dot that Dubnyk had no chance of seeing through traffic in front of the crease.

Hertl put San Jose up 63 seconds after that, redirecting a pass from Brent Burns just past Dubnyk's stick side.

Doan tied it midway through, punching in his 10th of the season from just outside the crease after a pass by Antoine Vermette hit a skate and bounced toward the net.

San Jose had a goal waved off in the closing seconds of the second period, when Dubnyk knocked the goal off its moorings.

The Sharks paid him back in the third period with Dillon's carom goal.

"It was a shot that was probably going wide of the net and I was just trying to that side of the ice and we got an unfortunate bounce," Dubnyk said. "That's all I want to say about it."

NOTES: Coyotes D Oliver Ekman-Larsson, named an NHL All-Star last the weekend, played in his 300th career game. ... Sharks C Andrew Desjardins did not play so he could be with his wife, Mandy, who is pregnant with their first child. ... Coyotes C Martin Hanzal missed his fourth straight game with an upper-body injury. ... Dillon's goal was his first since last Feb. 27 against Carolina.