The department said in a brief statement yesterday that soldiers were patrolling the town of Tlataya when they came across a warehouse being guarded by armed men, who opened fire on the troops.
Twenty-one men and one woman were killed in the shoutout and soldiers rescued three women who said they had been kidnapped, it said. Soldier also seized 22 automatic rifles, two shotguns, 13 handguns, a hand grenade and dozens of round of ammunition.
The town of Tlataya is in the mountains near the state of Guerrero, an area known for growing marijuana.
Mexico state, which rings Mexico City, in recent months has seen an increase in killings linked to drug cartels.
Authorities didn't say if those killed in Mexico state were members of an organised crime group.