“He struck it.” The “He” is purposely ambiguous. The third person masculine singular could be Yahweh, it could be Joshua as the leader of the army, or it could refer to Israel as a collective fighting group. Actually, all were involved.
“the mouth of the sword.” Used to show great destruction, as if the sword was eating its victims (see commentary on Josh. 6:21).