We describe the structure of a versatile two-dimensional and time-dependent magnetohydrodynamics computer code which has been developed for astrophysical problems. It is capable of modelling relativistic gas flows with Lorentz factors up to ≈ 3. The gas is assumed to be adiabatic, non-self-gravitating and perfectly conducting. The code utilizes an explicit second-order Lax-Wendroff scheme incorporating a low dispersion error flux-corrected-transport algorithm. In order to assess the reliability, accuracy and limitations of the code, a number of shock tube and blast wave test problems has been solved, some of which are described in this paper. The largest errors occur in the modelling of the thin dense shells of matter which form in highly relativistic shocks. In general, however, the accuracy of the computed solution is found to be better than a few percent when the gas velocities are less than nine tenths the speed of light.