An Israeli military spokeswoman said dozens of Palestinians had been rioting in the area and some had tried to breach the border with Israel. She said soldiers fired warning shots in the air before shooting at people across the fence.
Spokesman for the Gaza Health Ministry Ashraf Al-Qidra said the two men killed, one an 18-year-old and the second aged 26, had been throwing stones along with dozens of others near the border.
Since the start of October at least 147 Palestinians have been killed by Israeli forces, 93 of them as they tried to attack Israelis, according to Israeli authorities. Most of the others died in clashes with Israeli security forces.
In the same period, Palestinian stabbings, car-rammings and gun attacks have killed 24 Israelis and a US citizen.
The wave of such attacks has been fuelled by Palestinian frustration over the collapse of peace talks, the growth of Jewish settlements on land Palestinians seek for a future state and Islamist calls for the destruction of Israel.