The Palestinian Red Crescent identified the men as Aboud Sobh, 29, and Mohammad Al Azizi, 22. The Fatah Al Aqsa Martyrs Brigades militant group claimed both those killed were members.
Israeli police said security forces came under fire during an arrest raid and "responded with live fire and other means until neutralising the terrorists inside the house and on its roof".
The Israeli military said four people were arrested.
A neighbour, Naser Estitya, 60, said he heard gunshots from inside the house before Israeli forces fired heavily at the building. "They were calling the name of one person, asking him to surrender," he told Reuters.
Photos from the scene showed part of the wall at the top floor was destroyed.
Palestinian Authority official Hussein Al Sheikh condemned the attack.
"Another crime committed by the occupation forces in the old city of #Nablus, where martyrs have fallen and many wounded," he wrote on Twitter.
"There was also destruction of homes and burning of property. We strongly condemn this crime, and we hold the occupation responsibility for its repercussions," said Mr Al Sheikh, who is also and secretary general of the Palestinian Liberation Organisation's executive committee.
Israeli forces have been carrying out near-daily raids in the West Bank in recent months, after men from the occupied Palestinian territory carried out a series of deadly attacks in Israel.
The military has faced armed resistance in some of the raids, which in several instances have turned deadly.
The western-backed Palestinian Authority regularly condemns such incursions.