Aims - We describe a newly-developed magnetohydrodynamic (MHD) code with the capacity to simulate the interaction of any arbitrary perturbation (i.e., not necessarily limited to the linearised limit) with a magnetohydrostatic equilibrium background. Methods - By rearranging the terms in the system of MHD equations and explicitly taking into account the magnetohydrostatic equilibrium condition, we define the equations governing the perturbations that describe the deviations from the background state of plasma for the density, internal energy and magnetic field. We found it was advantageous to use this modified form of the MHD equations for numerical simulations of physical processes taking place in a stable gravitationally-stratified plasma. The governing equations are implemented in a novel way in the code. Sub-grid diffusion and resistivity are applied to ensure numerical stability of the computed solution of the MHD equations. We apply a fourth-order central difference scheme to calculate the spatial derivatives, and implement an arbitrary Runge-Kutta scheme to advance the solution in time. Results - We have built the proposed method, suitable for strongly-stratified magnetised plasma, on the base of the well-documented Versatile Advection Code (VAC) and performed a number of one- and multi-dimensional hydrodynamic and MHD tests to demonstrate the feasibility and robustness of the code for applications to astrophysical plasmas.