  We present a simple, robust and highly efficient method for optimizing all
parameters of many-body wave functions in quantum Monte Carlo calculations,
applicable to continuum systems and lattice models. Based on a strong
zero-variance principle, diagonalization of the Hamiltonian matrix in the space
spanned by the wav e function and its derivatives determines the optimal
parameters. It systematically reduces the fixed-node error, as demonstrated by
the calculation of the binding energy of the small but challenging C$_2$
molecule to the experimental accuracy of 0.02 eV.
