We present an extension of the classical theory of calculus of variations to generalized functions. The framework is the category of generalized smooth functions, which includes Schwartz distributions while sharing many nonlinear properties with ordinary smooth functions. We prove full connections between extremals and Euler-Lagrange equations, classical necessary and sufficient conditions to have a minimizer, the necessary Legendre condition, Jacobis theorem on conjugate points and Noethers theorem. We close with an application to low regularity Riemannian geometry.