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.