From the Zelda Wikia.
"The only way to damage Stallord is by tackling its lower spinal vertebrae with the Spinner. Stallord will try to keep Link away by summoning Staltroops and spitting blasts of dark fire from its mouth. Knock away Stallord's three lowest vertebrae, and the beast will fall. The sandpit recedes, and the battle appears to have been won.
However, Stallord comes alive once more. Its head starts floating and pushes Link into a large circular pit. Use the Spinner to chase Stallord, which again spits fireballs at Link. He avoids these by jumping between the two walls. Jump into Stallord's head with the Spinner, and it will fall to the ground. Once in this vulnerable position, slash the blade embedded in its skull as many times as possible before it reawakens. Repeat this process and the Stallord will fall for the final time."