A 'spoiler' as you may see the word in answers here means that, if you're interested in reading a book or are still reading it, the answer will 'spoil' the end for you... a 'spoiler.'
In stories 'spoilers' are the same; a 'foreshadow' that gives up so much information about the very section it means to 'foreshadow,' it spoils the story by giving away those facts too soon.