Israel's army said in a statement that the men had beeb involved in launching rockets at Israel over the last week, as well as other attacks in recent years.
Militants attacking Israel from Gaza "do not have immunity, and will not be free to plan, plot and operate," said Lt. Col. Peter Lerner, an Israeli military spokesman. "Gaza rocket terrorism does not pay."
The Palestinian news agency Maan described the strike as the first targeted assassination by Israel since the formation of a Palestinian unity government at the beginning of June.
Militants in Gaza have fired 30 rockets in the last two weeks, five of which were intercepted before impact, an Israeli army statement said. This week, a rocket fell short and killed a 3-year-old Palestinian girl in Gaza.
On Thursday, Israel released the names of the two main suspects in the disappearance of the Israeli youths. They were identified as Marwan Kawasma and Amer Abu Aysha, Hamas operatives from Hebron.