We consider Hamburger, Stieltjes and Hausdorff moment problems, that are problems of the determination of a Borel measure supported on the real axis, on the semi-axis or on the interval (0,1), from a prescribed set of moments. We propose a unified approach to these three problems based on the use of the auxiliary dynamical system with the discrete time associated with a semi-infinite Jacobi matrix. It is shown that the set of moments determines the inverse dynamic data for such a system. Using the ideas of the Boundary Control method, for every N∈N we can recover the spectral measure of N×N block of Jacobi matrix, which is a solution to a truncated moment problem. This problem is reduced to the finite-dimensional generalized spectral problem, whose matrices are constructed from moments and are connected with the well-known Hankel matrices by simple formulas. Thus the results on existence of solutions to Hamburger, Stieltjes and Hausdorff moment problems are naturally provided in terms of these matrices. We also obtain results on uniqueness of the solution of the moment problems, where as a main tool we use Krein-type equations of inverse problem.