An accessory is something extra that is not always necessary, but that goes with a main unit. For example, a charger or an earphone is an accessory to a cell phone. A spare part, however, is the same thing of something already in a unit, that is required to fix the unit if the part in that unit breaks down. So say your kitchen faucet started to leak because the knob is broken. An extra knob that you had lying around that can be used to replace the broken knob is a "spare part."