The two examples above obviously won't show up correctly for anyone using alternate color schemes or themes, light text on dark backgrounds, high contrast modes, simplified reading modes, etc.
Another option using a color tag is the "transparent" parameter:
[color=transparent]Spoiler text.[/color]
Using this method, the text will always blend with the background, regardless of the background color, so it will also work when using custom themes or high contrast modes.
If you post text with "transparent" color, anyone reading your post will not know there is text hidden unless you say so in your post. (I also suspect that some spammers may read this thread to get ideas as to how to make posts with a sufficiently large character count without having to write something coherent.
An actual spoiler tag would allow the text to be clearly marked as a spoiler, and will allow the reader to easily view the spoiler text. Users could also have the option of displaying spoiler text by default.