Israel said it would abide by a unilateral Egyptian-brokered ceasefire in Gaza on Wednesday, so long as no further projectiles were fired from the embargoed strip after Tel Aviv said it had struck 25 "military targets" in air raids overnight.
Khalil Al Hayya, a senior Hamas official, said Egyptian mediators intervened "after the resistance succeeded in warding off the aggression". He said groups in Gaza would commit to the ceasefire as long as Israel does.
Israeli Cabinet minister Aryeh Deri told Israel's Army Radio that he expected calm to be restored.
"If it will be quiet, we will respond with quiet. We've given Hamas a chance to prove that we can return to routine ... If they release the reins there will be a very painful strike," he said. "There is a good chance that the routine will be restored after the blow the army unleashed on them."
The overnight targets – part of the worst military flare-up since a 2014 war – included drone sheds, a rocket-making workshop and military compounds, the Israeli military said.
On Tuesday, Israel said it hit more than 35 militant sites in the Palestinian enclave after a barrage of rocket and mortar fire from Hamas and Islamic Jihad.
It said late on Tuesday about 70 rockets and mortars had been fired at Israel throughout the day. A number were intercepted by air defence systems.
Israeli Prime Minister Benjamin Netanyahu said Israel gave Palestinian militant groups in Gaza "the strongest blow dealt to them in years," and warned against renewed rocket fire.
"When they try us, they pay immediately. And if they continue to try us, they will pay a lot more," Netanyahu said at a ceremony in Tel Aviv.
But neither Israel nor the Palestinian factions in Gaza went full bore in their attacks, a sign that neither side was interested in escalating hostilities. Militants in Gaza did not fire long-range rockets at Israel's major cities, as they did in 2014, and Israeli airstrikes zeroed in on only unmanned military targets.
Three Israeli soldiers were wounded. There was no immediate report of casualties in Gaza.
Sirens and explosions continued into the night after Tuesday's incidents.
Late on Tuesday, a spokesman for Islamic Jihad said a ceasefire agreement had been reached to restore calm, although the Israeli army declined to comment.
In a rare joint statement, Hamas and Islamic Jihad declared shared responsibility for the rocket and mortar fire, saying it was in retaliation for Israeli attacks targeting their positions.
The exchange of fire comes after weeks of deadly protests and clashes along the Gaza-Israel border. Three members of Islamic Jihad were killed in an Israeli strike on Sunday.
The border area has been tense in recent weeks as Palestinians are demanding an Israeli-Egyptian blockade imposed after Hamas seized power in 2007 be lifted.
More than 110 Palestinians have been killed by Israeli gunfire. Most of them were killed during the Hamas-led protests, which climaxed on May 14.
The previous war, in 2014, was especially devastating, with more than 2,000 Palestinians killed, including hundreds of civilians, and widespread damage inflicted on Gaza's infrastructure in 50 days of fighting. Seventy-two people were killed on the Israeli side.
Palestinian anger has risen after the relocation of the US embassy from Tel Aviv to Jerusalem, and Washington's ever-closer relations with Israel that has allowed the right-wing government of Mr Netanyahu to continue settlement construction in the West Bank and East Jerusalem, areas the Palestinians seek for any future state.
Israel on Wednesday approved construction of 1,958 new settler homes in the occupied West Bank, Israeli settlement watchdog Peace Now told AFP.
It was fewer than the 2,500 for which Defense Minister Avigdor Lieberman said last week he intended to seek approval.
It was the first tranche of settlement approvals since the controversial US embassy transfer. A total of 14,000 settlement units have been approved since Mr Trump was inaugurated, more than three times the amount approved in the year and a half before he entered the Oval Office.
Peace Now said that in Wednesday's batch, around 700 units got final approval while the remainder passed the first approval stage in the planning process.
It said that the majority were in isolated settlements outside the major "blocs" which the government will seek to retain in any future peace agreement with the Palestinians.
Israel's West Bank settlements are considered illegal under international law. More than 400,000 Jewish settlers now live in the territory, growing at a speed that continues to reduce hopes of a Palestinian state.