Niemi made nine saves in the third period to help the Sharks hang on for their fifth win in six games.
Patrick Elias got the Devils' only goal on a third-period power play.
Martin Brodeur made 28 saves for New Jersey, which wrapped up a three-game California road trip with a 2-1-0 mark.
Ray Liotta sues skin care company over use of likeness
Millions of Getty images now available for free via embed tool