GAZA CITY, Gaza Strip — Gaza residents cleared rubble and claimed victory on Thursday, just hours after an Egyptian-brokered truce between Israel and Gaza’s Hamas rulers ended the worst cross-border fighting in four years.

The cease-fire announcement had set off frenzied late night street celebrations in the coastal strip, and raised hopes of a new era in relations between Israel and Hamas. The two sides are now to negotiate a deal that would open the borders of the blockaded Palestinian territory.

“Today is different, the morning coffee tastes different and I feel we are off to a new start,” said Ashraf Diaa, a 38-year-old engineer from Gaza City.

However, the vague language in the agreement and deep hostility between the combatants made it far from certain that the bloodshed would end.

Israel launched the offensive on Nov. 14 to halt renewed rocket fire from Gaza, unleashing some 1,500 airstrikes on Hamas-linked targets, while Hamas and other Gaza militant groups showered Israel with hundreds of rockets.

It was the worst fighting since an Israeli invasion of Gaza four years ago.

The eight days of relentless strikes killed 161 Palestinians, including 71 civilians, and five Israelis. Israel also destroyed key symbols of Hamas power, such as the prime minister’s office, along with rocket launching sites and Gaza police stations.

Despite the high human cost, Hamas claimed victory Thursday.

“The masses that took to the streets last night to celebrate sent a message to all the world that Gaza can’t be defeated,” said a spokesman, Sami Abu Zuhri.

While it is far from certain that Hamas will be able to pry open Gaza’s borders in upcoming talks, the latest round of fighting has brought the Islamists unprecedented political recognition in the region. During the past week, Gaza became a magnet for visiting foreign ministers from Turkey and several Arab states – a sharp contrast to Hamas’ isolation in the past.

Israel and the United States, even while formally sticking to a policy of shunning Hamas, also acknowledged the militant group’s central role by engaging in indirect negotiations with the Islamists. Israel and the West consider Hamas, which seized Gaza by force in 2007, to be a terrorist organization.