JERUSALEM — Hamas unilaterally declared a cease-fire with Israel on Wednesday, ushering in a fragile calm along the Gaza border after a short but intense round of fighting and easing the prospect of an imminently broader conflict.

In response, Israeli officials signaled that the government was willing to end this round, saying it would act only in response to fire from Gaza.

The announcement by Hamas came after nearly 24 hours of cross-border blows, in what was the fiercest exchange since the 50-day war in the summer of 2014. According to the Israeli authorities, Islamic militants in Gaza fired scores of mortar shells and short-range rockets into southern Israel, and the Israeli Air Force bombed at least 65 military sites across the Palestinian coastal territory.

Both sides appeared to have calibrated their actions to avoid an all-out conflict: The militants did not fire longer-range rockets at major Israeli population centers, and Israel appeared to have bombed unmanned facilities. With both sides seeing little to gain from a fourth war in a decade, according to experts, each called it a day and declared victory, saying it had managed to deter the other.

There were no reports of Palestinian or Israeli fatalities.

Hamas, the Islamic militant group that controls Gaza, issued a statement after 4 a.m. Wednesday, saying it had agreed to return to the Egyptian-brokered cease-fire understandings that ended the 2014 war. Hamas added that armed groups in Gaza would commit to the deal so long as Israel followed suit. It said it had agreed to the cease-fire after it succeeded in “repelling the aggression and preventing a change in the rules of engagement.”

Hamas and another group, Palestinian Islamic Jihad, took joint responsibility Tuesday night for the rocket and mortar fire.

Israeli officials said that the government was not party to any new, formal deals with Hamas but that Israel would take its cue from the militant groups and act only in response to fire from Gaza.

“I believe there are indirect understandings with Hamas to end this current round,” Yuval Steinitz, Israel’s minister of national infrastructure, said on Israeli public radio a few hours into the cease-fire. “There is an intention to close this round.”

While tensions along the border are likely to continue, he said of the militant groups, “I hope they won’t force us to embark on a full-scale military campaign to conquer Gaza.”

The Israeli government projected an air of business as usual: Schools opened, though some parents in the border area around Gaza kept their children home; and Prime Minister Benjamin Netanyahu’s office said Wednesday morning that he would attend an annual memorial ceremony that afternoon in a cemetery near Tel Aviv for the victims of an internal military clash in 1948, as he does every year.

Meanwhile, in the isolated and impoverished Gaza Strip, the border crossing for goods reopened on Wednesday, and war-fatigued residents went back to celebrating the holy Muslim month of Ramadan.

Image

Palestinian militants in the Gaza Strip fired rockets toward Israel early Wednesday, before a cease-fire was declared.CreditHatem Moussa/Associated Press

The latest escalation in violence occurred after weeks of deadly protests, arson attacks and armed clashes along Gaza’s border with Israel. Islamic Jihad began firing heavy barrages of mortar shells around 7 a.m. on Tuesday, in retaliation for an Israeli strike that killed three of its members on Sunday.

The Israeli military said that the strike had been in response to the planting of an explosive the night before along the security fence dividing Gaza from Israel. The device was neutralized and caused no injuries.

Tensions had been building for weeks, with as many as 120 Palestinians killed by Israeli fire since March 30, most of them by snipers during protests along the border and half of them in a single day, on May 14, according to the Gaza Health Ministry.

That marked the peak of a campaign called the Great Return March. Palestinians said they were challenging a 11-year blockade of Gaza and pressing claims to land in what is now Israel. Israel said it was defending its border and the nearby communities against a mass breach by the protesters and potential violence.

Experts on both sides said the outcome of the flare-up had essentially restored the situation to what it was.

“The main title of this round is ‘Rules of Engagement,’ ” said Mkhaimar Abusada, a professor of political science at Al-Azhar University in Gaza. Hamas and Islamic Jihad argued that Israel was trying to change the rules of the 2014 cease-fire over the past few months, he said, by bombing targets in the Gaza Strip such as attack tunnels leading to Israel, or by launching the deadly strike against the Islamic Jihad post over the weekend

Now, Professor Abusada said by phone, the groups believe that their rocket and mortar fire had succeeded in sending “a crystal-clear message to Israel that if Israel targets Palestinians and bombs Gaza, it should expect Palestinian retaliation.”

Israel, for its part, has been taking aggressive action on various fronts to deter its enemies, including recent wide-scale action against Iranian targets in Syria. With the recent hostilities in Gaza, experts said, Israel had reminded Hamas of its air superiority and intelligence dominance and had driven home the point that testing Israel was not worth it.

“At end of day, we have taken some very effective strikes against the positions and elements of the terrorist infrastructure of Hamas and Islamic Jihad,” said Yossi Kuperwasser, a former director general of Israel’s Ministry of Strategic Affairs. That, he said, “led the terror organizations to conclude that it is against their interest to continue at this point in time.”

Mr. Kuperwasser said the groups had “paid a heavy price.”

“They know it better than most people who are not familiar with the infrastructure of Hamas and Islamic Jihad,” he said, adding, “We are going back to where we were.”

The Israeli military said its targets had included drone storage facilities, rocket manufacturing sites and naval weaponry. Expecting an onslaught, the militants deserted their posts well ahead of time. The last wave of Israeli airstrikes ended around 1 a.m. Other stated targets included military compounds and training facilities, which might have been not much more than patches of empty ground.

Both sides tried to have the proverbial last word before the guns fell silent. Hamas first mentioned a cease-fire around midnight, but Israel denied it.

The subsequent Israeli strikes were followed by a final, and risky, salvo of mortar shells and rockets before dawn. One rocket damaged a home, but the occupants were sleeping in a fortified area inside. Another went miles beyond the border area and smashed into an empty stadium in the southern Israeli town of Netivot.

A version of this article appears in print on , Section A, Page 6 of the New York edition with the headline: Hamas Declares Cease-Fire With Israel After a Day of Cross-Border Strikes. Order Reprints | Today’s Paper | Subscribe