Hit it with an attack every time it changes its element and it will counter with a spell of that element. Pound it with spells of the opposite element until it changes again. Rinse and repeat.

Avoid elemental weapons unless you feel like changing weapons in mid-battle.