The Israeli military has struck a Hamas border post in northern Gaza with a tank shell, killing two members of the Palestinian group's military wing.
The military said the tank responded to shots fired at soldiers from the post.
But Hamas said its fighters were taking part in a live-fire exercise and that Israel would pay for their deaths.
The incident comes as the UN and Egypt continue to try to broker a deal for a lasting ceasefire between Israel and Hamas, which dominates Gaza.
A video released by the Israeli military shows two men in a watchtower, said to be in northern Gaza, and puffs of smoke as one appears to open fire. It then cuts to footage of a shell hitting the post and an explosion.
Hamas's military wing, the Izz al-Din Qassam Brigades, confirmed two of its members were killed, but said the border post was hit during an "exhibition" by a naval commando unit that was being watched by several Hamas leaders.
"The resistance cannot allow the occupation to impose a policy of bombing sites and targeting fighters without paying the price," a Hamas statement said.
Raw footage: Hamas terrorists shooting at IDF troops from an outpost in the Gaza Strip pic.twitter.com/3ybzw8w3jW— IDF (@IDFSpokesperson) August 7, 2018
The Israeli military said none of its troops was injured, but warned that it was prepared to "target any aggression against Israel and holds Hamas responsible for everything happening in and emanating from the Gaza Strip".
The cross-border incident came after a delegation of senior Hamas officials visited Gaza to discuss a ceasefire agreement with Israel proposed by the UN and Egypt.
Israel's security cabinet discussed the proposal on Sunday, but afterwards ministers said only that the Israeli military was "prepared for any scenario".
In the past four months, there has been an upsurge in violence along the Gaza-Israel border.
More than 160 Palestinians have been killed by Israeli forces - most during weekly protests at which thousands of Palestinians have expressed their support for the declared right of Palestinian refugees to return to their ancestral homes in what is now Israel.
Human rights groups have accused Israeli troops of using excessive force at the protests. Israel has said they only opened fire in self-defence or on people trying to infiltrate its territory.
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.