Hamas, which has de facto control of Gaza, said three of the men killed by the Israeli forces were from Izz al-Din al-Qassam Brigades, its armed group.
Another 20 people were wounded in the fighting, Muawiya Abu Hassanein, director of emergency services in Gaza, said.
He said that Palestinian ambulances were prevented from reaching the scene of the incident to attend to more casualties.
Israel this week stepped up ground and air operations against Islamic Jihad, which has spearheaded cross-border rocket attacks from Gaza.
Hours after the Israel raid near Maghazi, three rockets were fired into the Israeli border town of Sderot, one of which landed 40m from a school, Israeli police said.
Twelve children were treated for shock, the police said.
Hamas said it fired 21 mortar bombs at Israeli border posts. There were no reports of casualties from those attacks.