A spiders body is covered in a hard outer skin known as an exoskeleton. As the spider's body matures it sheds this hard outer skin to make space for its growing body. This period of shedding the exoskeleton is known as an 'instar'. A spider can go through 20 or more instars before it reaches its full, adult size.
Not only does the shedding allow for growth, but it will allow for regeneration too. If a spider is unfortunate enough to lose a leg, then provided it still has at least one more moult left in its life cycle it's able to grow a new leg.
In most species the new leg is thinner and shorter than the original leg. It can take two or three moults until the regenerated limb matches the original in appearance.
Regeneration in spiders is not just limited to the legs. They also have the ability to grow new pedipalps, mouthparts, silk spinners and more.