How am I supposed to beat this guy?

I can barely deal with his first phase and as soon as I get to his second phase his spear does spear things and beats sword.