The accident occurred when a fire-extinguishing system went into operation in error aboard the submarine, Dygalo said. He said the dead included sailors and shipbuilders.
The submarine was heading back to shore on its own power, and 21 people injured in the accident were evacuated to a ship that was escorting the sub. There were 208 people total aboard the vessel.
Russia's navy has been plagued by deadly accidents, including the explosions that sank the nuclear-powered submarine Kursk in 2000, killing all 118 seamen aboard.
Sunday's accident came as the Kremlin seeks to restore Russia's naval reputation. A naval squadron is headed to Venezuela for joint exercises this month in a show of force near U.S. shores.