JERUSALEM — Israel and Hamas on Friday worked quickly to de-escalate after a rare instance of rocket fire from Gaza launched against Tel Aviv the night before.

The events underscored that neither side appears to want a broader clash right now, and at the same time, the ever-present chance of a miscalculation setting off the next war.

Thursday night, rockets from Gaza that headed for Tel Aviv seemed to come out of the blue, then disappear almost without a trace. Israel blamed Hamas, which controls Gaza, and retaliated swiftly, with strikes at what it said were Hamas military sites and compounds throughout Gaza.

Hamas denied responsibility for the attacks, but had nonetheless expected such a response and left the sites ahead of time.