The incident has rocked a fragile month-old ceasefire and drawn vows of revenge from Hamas leaders.
Medics said two other Palestinians died in protests following the raid - a man of 20 shot dead after throwing stones at troops and a 41-year-old bystander who inhaled teargas sprayed by soldiers dispersing rioters.
The military wing of Hamas identified their dead as Fayez Assader, 26, commander in the Nablus area, and Khamis Abu Salem, 22.
An Israeli soldier was killed during the raid.
Senior Hamas political leader Abdel Aziz al-Rantissi told Reuters that Hamas would react to the Nablus raid but said it stood by a three-month truce declared on 29 June in keeping with the US-backed Middle East "road map" plan.
"We are still committed to the hudna (ceasefire) but the violation by the Israelis will not pass without a reaction."
--Senior Hamas political leader Abdel Aziz al-Rantissi
"We are still committed to the hudna (ceasefire) but the violation by the Israelis will not pass without a reaction. There will be a reaction to each Israeli violation," he said.
Another prominent Hamas figure, Ismail Abu Shanab, had told Reuters earlier it would reassess the truce deal, seriously strained by Friday's violence.
An Israeli field commander, who could be identified under army regulations only as Colonel Harel, said the raid was aimed at arresting two senior Hamas men the army said were planning attacks on Israelis.
Colonel Harel said troops came under fire after calling on occupants in a building to come out. Residents heeded the call - the Hamas fighters did not.
During the exchange of fire, an explosive charge or an explosives-making workshop blew up, the officer claimed.
Witnesses said the blast caused the top floor of the three-storey building to collapse. The army then blew up the rest of the structure.
Local residents said eight families were made homeless.