The Sunday morning strike on the mosque, near the Al-Aqsa Hospital in Deir al-Balah in the central Gaza Strip, comes as the war between Israel and Hamas in the Palestinian enclave approaches its first anniversary.
Eyewitnesses said the number of casualties could rise as the mosque was being used to house displaced people.
The Israeli military said in a statement it "conducted a precise strike on Hamas terrorists who were operating within a command and control center embedded in a structure that previously served as the 'Shuhada al-Aqsa' Mosque in the area of Deir al Balah".
The IDF said the command and control centres "were used by Hamas terrorists to plan and execute terrorist attacks against IDF troops and the State of Israel".
It said it took "numerous steps" to mitigate harm to civilians.
It was another example of how Hamas used civilian infrastructure, in violation of international law, the IDF said.
The attack comes after powerful new explosions rocked Beirut's southern suburbs as Israel expanded its bombardment in Lebanon, striking a Palestinian refugee camp deep in the north for the first time as it targeted both Hezbollah and Hamas fighters.
Plumes of smoke have dominated the skyline over southern Lebanon after Israeli attacks. (AP PHOTO)
Thousands of people in Lebanon, including Palestinian refugees, continued to flee the widening conflict in the region, while rallies were held around the world marking the approaching anniversary of the start of the war in Gaza.
A series of strong explosions were reported near midnight on Saturday after Israel's military called on residents to evacuate areas in Beirut's Haret Hreik and Choueifat neighbourhoods.
Associated Press video shows blasts illuminating the skyline of the densely populated southern suburbs, where Hezbollah has a strong presence.
Thousands of people are fleeing Lebanon to escape Israeli airstrikes . (AP PHOTO)
Earlier on Saturday, Israel's attack on the northern Beddawi camp killed an official with Hamas' military wing along with his wife and two young daughters, the Palestinian militant group said.
Hamas later said another military wing member was killed in Israeli strikes in Lebanon's eastern Bekaa Valley. Residents confronted the aftermath: smashed buildings, scattered bricks and stairways to nowhere.
Israel's military said it killed two senior officials with Hamas' military wing in Lebanon, where fighting has sharply escalated.
At least 1400 Lebanese, including civilians, medics and Hezbollah fighters, have been killed and 1.2 million driven from their homes in less than two weeks. Israel says it aims to drive the militant group away from shared borders so displaced Israelis can return to their homes.
Iranian-backed Hezbollah began firing rockets into Israel almost immediately after the Hamas' October 7 attack, calling it a show of support for the Palestinians. Hezbollah and Israel's military have traded fire almost daily.
Last week, Israel launched what it called a limited ground operation into southern Lebanon after a series of attacks killed longtime Hezbollah leader Hassan Nasrallah and others.
The latest bloodshed in the decades-old Israeli-Palestinian conflict was triggered when Hamas militants attacked southern Israel on October 7, 2023, killing 1200 people and taking about 250 as hostages, according to Israeli tallies.
Israel's subsequent military assault on Gaza has killed nearly 42,000 Palestinians, according to Gaza's health ministry.
with dpa