We prove the applicability of the Weighted Energy-Dissipation (WED) variational principle to nonlinear parabolic stochastic partial differential equations in abstract form. The WED principle consists in the minimization of a parameter-dependent convex functional on entire trajectories. Its unique minimizers correspond to elliptic-in-time regularizations of the stochastic differential problem. As the regularization parameter tends to zero, solutions of the limiting problem are recovered. This in particular provides a direct approach via convex optimization to the approximation of nonlinear stochastic partial differential equations.