Israeli soldiers stand on an armoured personnel carrier (APC) outside the central Gaza Strip as they fire a 120 mm mortar shell towards Gaza July 31, 2014.Reuters

Israeli shelling killed 40 Palestinians in southern Gaza, hours after a humanitarian ceasefire came into effect on Friday morning.

The Palestinian interior ministry has confirmed the deaths in an attack in Rafah, southern Gaza. According to pro-Hamas news outlets, at least 20 people were wounded in the attack.

Israeli denied breaching the ceasefire, saying the firing was in response to a serious incident on the border in Kerem Shalom that caused casualties on their side.

Earlier, under a US and UN-brokered deal, Israel and Hamas agreed on a 72-hour truce in order to allow food and medical supplies to reach the wounded people.

The move came as the Obama administration and the UN Security Council stepped up pressure on Israel to avoid civilian casualties in the wake of the shelling of a Gaza school that sheltered civilians.

The humanitarian ceasefire in Gaza came into effect at 8 am local time on Friday.

Al Jazeera reported that shelling was heard shortly before the 8 am ceasefire, but that Gaza strip went quiet since then.

Officials from both Israel and Hamas, which controls Gaza, confirmed that both sides have agreed to the ceasefire proposal brokered by the US and UN.

"We urge all parties to act with restraint until this humanitarian ceasefire begins, and to fully abide by their commitments during the ceasefire," UN Secretary-General Ban Ki-moon and US Secretary of State John Kerry said in a joint statement.

'Much Needed Reprieve'

The 72-hour truce comes at a critical time as Israel intensified their offensive on Wednesday after Hamas released a video which showed the militants infiltrating into Israeli territory through a tunnel, and killing five of its soldiers – an incident that added to the fury of the Israeli Defence force with PM Benjamin Netanyahu vowing to destroy all tunnels within two weeks.

Ever since the violence began on 8 July, more than 1,420 Palestinians have been killed, most of them civilians. On the Israeli side, 61 soldiers have died so far.

The truce was announced late on Thursday, hours after the UN Security Council held an emergency meeting to address the humanitarian crisis in Gaza. The ceasefire is a much needed reprieve, the UN and the US have said.

"During this period, civilians in Gaza will receive urgently needed humanitarian relief, and the opportunity to carry out vital functions, including burying the dead, taking care of the injured and restocking food supplies. Overdue repairs on essential water and energy infrastructure could also continue during this period," the joint statement said.

A much more durable and longer ceasefire will also be discussed next in Cairo, where Israeli and Palestinian delegations will meet immediately for negotiations, the UN has said.