Note: this is a real animal, not one of my hypothetical critters.
Arachnura, or scorpion-tailed spiders, are a genus of orb-weavers native to Australia and Asia. As you can see, the name derives from a flexible, tail-like extension of the abdomen. When threatened, the spider will indeed wave its tail like a scorpion, however the appendage is soft and totally harmless.
I haven't been able to find any good explanation as to what purpose the tail serves. The most obvious answer would be mimicry, but other than the tail these guys don't particularly resemble their scorpion relatives. I'd imagine it might be used to startle predators who wouldn't be expecting this from a spider.