The entire building held 44 residential apartments.
"People started shouting Allahu Akbar, and women and kids were screaming," Maher Abu Sedo, an area resident, said. "This is crazy. The state of Israel has resorted to madness. In less than a minute, 44 families have become displaced. ... They lost everything, their house, their money, their memories and their security."
Israeli had fired a warning missile five minutes before the attack, allowing some residents to escape the homes in time.
But 22 people were wounded, including 11 children and five women, according to Gaza hospital officials.
Israeli military officials said the two missiles were targeting a Hamas operations room in the building, but did not explain why all 44 apartments were destroyed.
Since the fighting erupted on July 8, Israel has launched some 5,000 airstrikes at Gaza, while Gaza militants have fired close to 4,000 rockets and mortars, according to the Israeli military.
More than 2,100 Palestinians, including close to 500 children, have been killed, according to Palestinian health officials and U.N. figures. Israel has lost 64 soldiers and four civilians.
Israel says it is targeting sites linked to militants, including rocket launchers, command centers and weapons depots. The U.N. says about three-fourths of the Palestinians killed in the airstrikes and fighting have been civilians.
The Associated Press contributed to this report.