Yes, but if you're fighting a Sectopod in melee combat, you have much bigger problems than whether or not the spear was the right weapon.
Also, we could also strap directional charges on the end of a spear, and smash them into the enemy's face. Granted, it'd be a single use weapon, but...