* U.N.-requested truce will allow Gazans to resupply
* Israel says repels attack by gunmen who tunnelled in
* Diplomacy continues for permanent ceasefire
By Nidal al-Mughrabi and Ari Rabinovitch
GAZA/JERUSALEM, July 17 (Reuters) - Israel and Hamas said they would cease fighting for five hours on Thursday for a humanitarian truce requested by the United Nations, though Israel remained poised to expand its offensive in the Gaza Strip if rocket fire persisted.
Just a few hours before the temporary truce was due to take effect at 10 a.m. (0700 GMT), Israel's military said it repelled an attack by at least a dozen Palestinian gunmen who tunnelled in from Gaza near an Israeli community.
At least one of the gunmen was killed after Israeli aircraft bombed the group, it said.
Israel said the break was to allow Gaza residents to gather supplies and repair infrastructure damaged in 10 days of warfare in which Israeli fire has killed at least 221 Palestinians, most of them, Gaza health officials said, civilians.
In Israel, a civilian has been killed by one of more than 1,300 Palestinian rockets fired and more than half a dozen people have been wounded in frequent strikes that have made a race to shelters a routine for hundreds of thousands of people.
Hamas, the Islamist group that controls Gaza, also said it accepted the U.N. plea for a "humanitarian pause" in fighting.
After the early morning clash over the tunnel, air raid sirens sounded across Israel, including in the Tel Aviv area, the country's heartland, warning of a heavy barrage of incoming rockets. The military said at least one rocket was intercepted by the Iron Dome anti-missile system and another fell in a town near Tel Aviv. There were no reports of casualties.
Israel's military said it would respond "firmly and decisively" if militants in Gaza launched attacks during the five-hour break.
President Barack Obama said on Wednesday the United States supported Egyptian efforts to bring about a ceasefire. U.S. officials would use their diplomatic resources over the next 24 hours to pursue closing a deal, he said.
Egypt had proposed a permanent ceasefire plan on Tuesday, which Israel accepted and Hamas, saying its terms had been ignored, rejected.
Israeli media reports said Egypt was continuing its truce efforts and that senior Israeli officials would hold talks in Cairo on Thursday on a ceasefire. A spokesman for Prime Minister Benjamin Netanyahu declined to comment.
On Wednesday, an Israeli gunboat off Gaza's Mediterranean coast shelled a beach, killing four boys - two aged 10 and the others 9 and 11 - from one family and critically wounding another youngster, witnesses and Ashraf al-Qidra of the Gaza Health Ministry said.
The Israeli military said the reported civilian casualties were unintended and "tragic" and it was investigating what happened. "Based on preliminary results, the target of this strike was Hamas terrorist operatives," it said in a statement.
One Israeli has been killed by shelling from Gaza since the Israeli offensive began on July 8, in conflict largely triggered by the killing of three Israeli teens in the occupied West Bank and the death of a Palestinian youth in a suspected revenge murder.
Most of the Palestinian projectiles have crashed on open ground or been intercepted by Iron Dome.
Gaza's Al-Mezan Center for Human rights said 259 houses have been demolished by Israeli air strikes and 1,034 damaged, along with 34 mosques and four hospitals.
(Additional reporting by Dan Williams in Jerusalem, Writing by Ari Rabinovitch, Editing by Jeffrey Heller and Ralph Boulton)
Our Standards: The Thomson Reuters Trust Principles.