  In this paper, we develop a new method for magnetohydrodynamics (MHD) using
smoothed particle hydrodynamics (SPH). To describe MHD shocks accurately, the
Godunov method is applied to SPH instead of artificial dissipation terms. In
the interaction between particles, we solve a nonlinear Riemann problem with
magnetic pressure for compressive waves and apply the method of characteristics
for Alfv{\'e}n waves. An extensive series of MHD test calculations is
performed. In all test calculations, we compare the results of our SPH code
with those of a finite-volume method with an approximate Riemann solver, and
confirm excellent agreement.
