In this paper we identify conditions under which the introduction of a pay-as-you-go social security system is ex-ante Pareto-improving in a stochastic overlapping generations economy with capital accumulation and land. We argue that these conditions are consistent with many calibrations of the model used in the literature. In our model financial markets are complete and competitive equilibria are interim Pareto efficient. Therefore, a welfare improvement can only be obtained if agents' welfare is evaluated ex ante, and arises from the possibility of inducing, through social security, an improved level of intergenerational risk sharing. We will also examine the optimal size of a given social security system as well as its optimal reform. The analysis will be carried out in a relatively simple set-up, where the various effects of social security, on the prices of long-lived assets and the stock of capital, and hence on output, wages and risky rates of returns, can be clearly identified.