This photo shows a general view of Gaza city. Reuters
The dawn executions, by hanging or firing squad, were the first in the Palestinian territories since 2017. Past cases of capital punishment being carried out in Gaza have drawn criticism from human rights groups.
The ministry statement did not provide full names for any of the condemned men. It said three had been convicted of murder. The two convicted spies, aged 44 and 54, had given Israel information that led to the killing of Palestinians, it said.
The Israeli Prime Minister's Office, which oversees the country's intelligence services, declined comment.
"The execution was carried out after the conclusion of all legal procedures. The rulings had been final, with implementation mandatory, after all of the convicted were accorded full rights to defend themselves," the statement said.
Reuters could not immediately corroborate this.
Palestinian and international human rights groups have condemned the death penalty and urged Hamas and the Palestinian Authority, which exercises limited self-government in the Israeli-occupied West Bank, to end the practice.
Palestinian law says President Mahmoud Abbas has final word on whether executions can be carried out. But he has no effective rule in Gaza.
Since Islamist Hamas seized control of Gaza from Abbas in 2007, its courts have sentenced dozens of Palestinians to death, and have executed 27 so far, according to human rights groups.