The Sharks won their second straight and jumped over Los Angeles into the lead in the Pacific Division.
Corey Perry beat Niemi with a backhander for his 15th goal of the season, but the Ducks could not get any of their other 26 shots past the San Jose goaltender. Niemi has given up 14 goals over his last seven appearances.
San Jose scored twice in a span of 27 seconds of the middle period to take the lead. Brad Winchester delivered the tying goal and Benn Ferriero put San Jose in front with 3:10 to go in the second period.