The four - who were armed with Kalashnikov rifles, hand grenades and rocket propelled grenade launchers - tried to enter Israeli territory from the Khan Yunis area of Gaza early Saturday morning.
They were shot and killed by a force of troops from the Golani Brigade.
IDF troops deployed in the area opened fire after one of the terrorists crossed the fence - killing the four. A grenade was hurled during the incident.
There were no casualties among the soldiers.
At the same time, Palestinians reported an attack on nearby Hamas positions.
Sources in the Gaza Strip say that three of the dead Palestinians were members of Hamas' unit responsible for preventing infiltration into Israel near the perimeter fence.
The sources said that the three were pursuing a fourth Palestinian who was carrying explosives and was trying to reach the fence.
According to the sources, this was when the IDF troops opened fire and killed the four.
The sources said the fourth person, whom the three Hamas men were chasing, belonged to the Salafist branch in the Gaza Strip.
The same sources named the three Hamas men as Abdullah Hamaida, aged 21; Abdullah a-Ghari, aged 19, and Ahmed Adini, aged 20.
No organization in Gaza, including Hamas, has yet to take responsibility or confirm the identities of those killed.
The troops involved in thwarting the attack are from the Golani 12th Battalion, which nine days ago were involved in an infiltration from Gaza a little south of the scene of the Saturday morning incident.
An IDF officer was shot dead and two soldiers were lightly wounded in the attack.