Answer:
When Beowulf sword, Hrunting, loaned to him by Unferth, fails to penetrate the mother's hide, Beowulf discovers a giant magic sword in the cave and is able to kill the mother with it. The victory is the the hilt of the weapon that killed Grendel's mother. Beowulf is battling for the forces of good because supernatural forces intervene (he can swim many hours under water in the mere, he can make use of the massive giants' sword, his actions in the mere restore the lake to its pristine condition). I believe Grendel's mother's attack on Heorot is justified. When she attacks the warriors, Grendel's mother takes revenge for Grendel's death. She follows the Anglo-Saxon code that says surviving family members of murder victims should take revenge for their family members' deaths.
Hope this helps:)