The ultimate defeat of Gog's massive army will not come about through direct combat with the Israelites. Instead, divine intervention will turn the attackers into the agents of their own destruction. God summons a sword to strike down the invading forces. The primary approach among commentators is that this sword will attack Gog throughout the mountains of Israel, where the enemy troops are camped [רד״ק, מצודת דוד, שטיינזלץ]. Taking a different perspective, [מלבי״ם] suggests that God metaphorically names the mountains themselves as the sword, indicating that the very landscape will serve as the instrument of destruction against the invaders.
The true nature of this devastation is that it will not be delivered by any outside force, but will erupt from within the camp itself. God will cast a deep panic and overwhelming confusion over the soldiers of Gog, causing them to completely lose their senses. In their terror, they will turn on each other, shedding the blood of their own comrades [רש״י, רד״ק, מצודת דוד].
Adding another layer of meaning to this internal slaughter, some commentators identify the warring factions as the nations of Edom and Ishmael. Bound by their historical roots as brothers, their infighting will be exceptionally violent and severe. This mutual destruction will be so intense that it resembles a terrifying earthquake, one that shatters mountains through sheer panic and chaos [אברבנאל, מלבי״ם].