Medics said 10 people were killed in the Gaza City suburb of Zeitoun, two in Shejaia suburb to the east and the rest in two separate attacks in Khan Younis in the south of the Gaza Strip.
The Israeli military said its forces struck Hamas targets across the strip after members of the Palestinian militant group fired on its troops in violation of the nearly six-week-old ceasefire.
No Israeli forces were injured.
Repeated shooting incidents have pointed to the fragility of the ceasefire.
Israel and Hamas have traded blame for what both call violations of the US-brokered truce, the first stage of President Donald Trump's 20-point plan for a post-war Gaza Strip.
All three attacks were far beyond an agreed-upon imaginary "yellow line" separating the areas under Israeli and Palestinian control, according to medics, witnesses and Palestinian media.
The Zeitoun attack was on a building belonging to Muslim religious authorities and the Khan Younis attack was on a United Nations-run club, both of which house displaced families.
The October 10 ceasefire in the two-year Gaza Strip war has eased the conflict, enabling hundreds of thousands of Palestinians to return to the enclave's ruins.
Israel has pulled troops back from city positions, and aid flows have increased.
But violence has not completely halted.
Palestinian health authorities say Israeli forces have killed 305 people in strikes on the Gaza Strip since the truce, nearly half of them in one day last week when Israel retaliated for an attack on its troops.
Israel says three of its soldiers have been killed since the ceasefire began and it has targeted scores of fighters.