A statement by the IDF said that troops fired toward three terrorists who tried to cross the border fence in the southern Gaza Strip, enter Israeli territory and damage what it described as "security infrastructure" near the fence.
The Palestinian Ministry of Health in Gaza identified the two protesters as Baha' Qdeih, 23, and Mohammad Abu Reeda, 20.
It says it only opens fire when necessary to stop infiltrations, attacks and attempts to damage the fence.
Gaza media reported the explosion was a "work accident", meaning the terrorists were killed when explosives they were dealing with went off.
The latest deaths raised to 52 the toll of Palestinians killed by Israeli occupation forces since protests began along the Gaza border on March 30.
The protest will be ongoing until May 15's Nakba Day - the day of "catastrophe" that marks the establishment of the State of Israel, which this year celebrates its 70th anniversary.
No Israelis have been hurt in the weeks of protests and occupation forces have faced global criticism for their use of live ammunition.
Ezzedine al-Qassam said the dead were all its members and blamed Israel for the explosion, without providing details or proof.
Reuters television captured a pillar of smoke rising above the village of Zawayda near the coast of Gaza, far from the border with Israel where tensions have escalated in recent weeks. Israel accuses Hamas, which is sworn to Israel's destruction, of trying to carry out attacks under the guise of the mass protests.
Israel says that it is defending its sovereign border, including nearby communities, and that its troops target only instigators.
Of those, three were shot dead on Sunday.
Security officials, speaking on condition of anonymity, and eyewitnesses said that a huge blast occurred in a house of a Hamas militant in the town, which was the result of a bomb that had suddenly exploded. "Two suspects were killed".