Israel unleashed its biggest air strikes on the Gaza Strip since a 2014 war Saturday, killing two Palestinians, while dozens of rockets targeted Israel, but Hamas said a ceasefire had been reached late in the day.
The exchange of fire followed months of tension that has raised the prospect of a fourth war in the blockaded Gaza Strip since 2008.
Three Israelis were wounded when a rocket hit a house in the city of Sderot near the Gaza Strip, authorities said.
The two Palestinians killed were aged 15 and 16, caught in an Israeli strike on a building they were near in the west of Gaza City, the enclave's health ministry said.
Twenty-five people were wounded across Gaza, the ministry said.
Hamas spokesman Fawzi Barhoum said late Saturday the Islamist movement, which runs the Gaza Strip, had agreed to an "Egyptian offer to return to a ceasefire to stop this escalation."
An Israeli military spokesman declined to comment, but said its actions would depend on what happens on the ground.
Thick plumes of smoke rose over parts of the Gaza Strip as Israel hit dozens of targets it said belonged to militants, including a high-rise building allegedly used by Hamas as a training facility with a tunnel underneath.
In Israel, air raid sirens sent people rushing to shelters in areas surrounding the Gaza Strip as rockets and mortars were fired from the Palestinian enclave at nearby communities.
Israel said around 100 rockets and mortars were fired, mostly mortars.
Hamas said it fired in defence in response to Israeli air strikes.
Israel blamed Hamas for the escalation, pointing to months of protests and clashes along the border that its military argues the Islamist movement is seeking to use as cover for attacks.
There have also been hundreds of fires at Israeli farms caused by kites and balloons carrying firebombs from Gaza, leading to political pressure on the government and military to take action against Hamas.
Israeli Prime Minister Benjamin Netanyahu said Hamas had been hit with "the hardest blow" since a 2014 war "and we will increase the strength of our attacks as necessary."
Hamas's Barhoum said the group was responsible for the barrage against Israel and that it was carried out "in response to the Israeli air strikes".
"The protection and the defence of our people is a national duty and a strategic choice," Barhoum said.
Tensions have been building between Hamas and Israel for months over mass protests and clashes along the border fence.
The protests have called for Palestinian refugees to return to their former homes now inside Israel.
Since the protests and clashes broke out along the border on March 30, at least 141 Palestinians have been killed by Israeli fire.
The majority of those killed were involved in protests and clashes but others were seeking to breach or damage the border fence.
No Israelis have been killed.
In addition, the arson balloons and kites from Gaza have caused 750 fires and burned 2,600 hectares, leading to hundreds of thousands of dollars in damage, according to Israel's fire service.
On July 9, Israel closed its only goods crossing with the Gaza Strip in response to the fires.
Hamas called the move a "crime against humanity," with Gaza already suffering from deep poverty and worsening humanitarian conditions.
The border protests peaked on May 14, when the United States moved its Israel embassy to the disputed city of Jerusalem, but have continued at a lower level since then.
On Friday, Israeli troops shot and killed two Palestinians, including a teenager, and wounded hundreds of others in border clashes.
An Israeli soldier was also moderately wounded when a grenade was thrown at him from the northern Gaza Strip, the military said.
Molotov cocktails, flaming tyres and stones were also hurled in the direction of its soldiers, according to the Israeli army.
Israel says its use of live fire is necessary to defend its borders and stop infiltrations. Palestinians and rights groups say unarmed protesters are being shot while posing no real threat.
Israel's army said Saturday's strikes targeted military facilities belonging to Hamas.
Among the main targets was the "Hamas Battalion HQ in Beit Lahia, which includes urban warfare training facilities, (a) weapon storage warehouse, training compounds, command centres, offices and more", the Israeli army said in a statement.
"A weapons manufacturing site and storage facilities housing various types of weapons, including Hamas' naval capabilities" were also hit, the statement added.
The Israeli army said air strikes carried out in the morning hit "complexes used to prepare arson terror attacks and a Hamas terror training facility".
"We are talking about the biggest offensive strikes since Protective Edge," Air Force Brigadier General Tzvika Haimovic told journalists, referring to Israel's name for its 2014 operation in the Gaza Strip.