This paper proposes a nonparametric estimator of the stochastic discount factor (SDF). The SDF is assumed to depend on a vector of prespecified factors but no functional form is imposed a priori. We introduce a penalized generalized method of moments (PGMM) estimation procedure for the SDF in which the minimand is the sum of two terms. The first term involves a set of population moment conditions derived from the definition of an SDF The second term is a roughness penalty. It is shown that the PGMM estimator is a smoothing spline. The method is illustrated via an empirical application to the pricing of a benchmark set of assets which consists of 25 industry portfolios, the SP500 index, and the 30-day Treasury bill. The results suggest that these benchmark asses can be priced by our nonparametric SDF with the SP500 index and the 30 Treasury bill as factors.