Nieto scored off a centering pass from Marcus Sorensen to give the Sharks a 1-0 lead at 12:50 of the first period.
Alexander Chmelevski, who is from Newport Beach, California, just south of Anaheim, got the secondary assist on the play in his NHL debut.
Adam Henrique pushed a rebound through the pads of Jones to tie it 1-1 at 10:03 of the second period.
Terry scored on a wrist shot from the slot to give the Ducks a 2-1 lead at 13:48, and Comtois scored off a pass from Rickard Rakell from behind the net to extend the lead to 3-1 lead at 18:22.
"In that second period, we've got to look at the way that we worked them down low, the way that we found a way to get those pucks to the net and get those scrappy goals," Comtois said. "Right now, we're not scoring a lot of goals, and I think that's one way to get back on track and get those goals coming for us."
NOTES:Sharks forward Patrick Marleau, who moved from the fourth to the second line, played his 1,732nd game, passing Ron Francis for fourth place in NHL history. ... Anaheim forward Ryan Getzlaf was a late scratch because of a lower-body injury. ... Ducks forward Derek Grant had two assists in his return after missing the previous three games with an upper-body injury.