The incident took place amid Egyptian efforts to broker a cease-fire between Israel and the Palestinian militant group, which controls the coastal strip. The sides have been engaged in months of border violence.
The military said an Israeli tank shelled the Hamas post after troops came under fire. It released a video appearing to show militants shooting from a watchtower before a tank shell hits the position.
Hamas later denied Israel's account, saying shots were fired as part of a graduation ceremony for a group of fighters inside the camp. The group's armed wing said the fighters' families and Hamas leadership attended the event, without providing names. It said Israel was "fabricating lies" and that it bore responsibility for the deaths.
Tensions have escalated since late March, when Hamas launched what would become regular mass protests along Israel's perimeter fence with Gaza. The protests have been aimed in part at trying to break the blockade imposed by Israel and Egypt after Hamas seized the territory in 2007.
Over the past four months, 160 Palestinians have been killed by Israeli fire, including at least 120 in the protests near the fence, according to the Gaza Health Ministry and a local rights group. One Israeli soldier was killed by a Gaza sniper during this period.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.