I always thought necessary was an adjective -and only an adjective. As such it means being essential, indispensable, or requisite.
I thought the noun was necessity but it turns out that necessary is also a noun - something necessary or requisite; a necessity.
Some people have problems spelling necessary. I pointed out the other day that I membered it by saying "It is necessary to have one
collar and two
studs". It was pointed out to me that the modern generation wouldn't know anything about collar studs - good point!