Arizona survived when Hanzal deflected a shot by Alex Goligoski past Sharks goalie Martin Jones. Radim Vrbata assisted on the goal, his 300th point with the Coyotes.
Tobias Rieder and Max Domi scored for Arizona (6-9-2), which ended a four-game losing streak (0-2-2).
"[Smith] was amazing tonight. That was why we won," said Hanzal, who has 22 career game-winning goals.
Joe Pavelski and Tommy Wingels scored in the third period for the Sharks (9-8-1), who went 3-2-1 on a season-long, six-game road trip that ended with three straight losses.
"In the last period of a six-game road trip, it was encouraging to see guys put their heads down and just work," Pavelski said. "We're disappointed we didn't get the extra point. We felt like we were on them a lot of the game."
The Coyotes had four shots in the first period, but made the first one count. Jordan Martinook set up Rieder with a pretty centering pass and Rieder scored at 1:55 for fifth goal and third in his past four games.
Smith made the lead stand up with big saves against Joonas Donskoi and Logan Couture in succession with three minutes left.
Arizona made it 2-0 on the power play after Brenden Dillon went to the penalty box for tripping Rieder. Domi took a pass from Hanzal and put a wrist shot past Jones at 7:53.
The Sharks finally struck in the third period. Pavelski got a stick on Justin Braun's shot from the point and deflected it over Smith at 41 seconds to make it 2-1.
Nieto took a cross-ice pass from David Schlemko and sent a shot that Wingels redirected by Smith at 10:28 to tie the game. Wingels has three goals in the past five games.