CONGRATULATIONS i got my spousal visa just last week u can imagine the excitement after so much worrying!!!
to answer your question u have to apply for the spousal visa after getting married... VAF2 i think? that will allow you to remain in UK 2yrs and and the last month before u get to those 2yrs u have to apply for the FLR or ILR i think not sure which one or they might be the same but this one will allow you to stay in the UK indefinitely with no time limit. on plus with the spousal one you can work.