It is a bug. It isn't something you can normally do, you have to do something to play in spectator mode. However, this is very looked down upon because I understand that a few crashes can be caused by this. It is going to be removed for beta 1.2 I believe.