We propose a new method of diagonalization oif hamiltonians of the Gaudin model associated to an arbitrary simple Lie algebra, which is based on the Wakimoto modules over affine algebras at the critical level. We construct eigenvectors of these hamiltonians by restricting certain invariant functionals on tensoproducts of Wakimoto modules. This gives explicit formulas for the eigenvectors via bosonic correlation functions. Analogues of the Bethe Ansatz equations naturally appear as equations on the existence of singular vectors in Wakimoto modules. We use this construction to explain the connection between Gaudin's model and correlation functios of WZNW models.