evolution of the spinneret: (note, i am just making this up)
ancestor squirted out some kind of vaguely sticky goop to hold eggs together.
goop got sticky-er and stringy-er over time.
spider evolved a little tube to help aim it.
spider evolved a little hair like thing to help string it.
spider evolved ability to move that hair like thing.
spider evolved behavior to coat lair sides with silk
more hair like things are evolved to better control silk placement
spider evolved rudimentary web weaving skills
spinneret became more complex
webs became more complex.
All that was made up by me on the spot, based on the knowledge that scientists suspect the start of the evolutionary process was in fact making an egg sac.
http://www.earthlife.net/chelicerata/web-evolve.html
No doubt my details are vastly wrong. But it's a reasonable, step-by-step path. For a real answer, consult a biologist.
Easy peasy.