The Ezzedin al-Qassam Brigades, the military wing of Hamas, rejected the official Israeli Army version and said the two Palestinian fighters did not open fire on Israeli soldiers at the border, but rather that they were participating in an exercise at a Hamas training camp.
The military said an Israeli tank shelled the Hamas post after troops came under fire.
The statement added that an Israeli army-affiliated tank then "targeted the post from which the shots were fired".
"The resistance can not allow the occupation to impose a policy of bombing sites and targeting fighters without paying the price", a Hamas statement said. The shelling killed two Palestinians.
The deaths of two of its fighters could trigger an escalation between Hamas and Israel.
"Israel is coming up with false allegations to justify its serious crime", Al-Qassam said, "We hold the occupation fully responsible for this attack".
United Nations and Egyptian-led efforts are under way to mediate a long-term truce between Israel and Hamas that would end a four-month surge of violence along the Israel-Gaza border.
The military released footage that it said was of the incident.
Smoke rises following an Israeli attack on the Gaza Strip as it seen from the Israeli side of the border, May 29, 2018.
One Israeli soldier has been shot dead by a Palestinian sniper during the same period, while incendiary devices attached to balloons and kites launched by Palestinians have sparked hundreds of fires in southern Israel, burning some 3,000 hectares (7,400 acres) of forest and farmland. Violence between the Palestinians and Israel has gained momentum late March, when Gazans started marching towards the fenced border with Israel in a series of protests calling for the right of Palestinian refugees to return to their lands in Israel.