XTROEM-FV: a new code for computational astrophysics based on very high order finite-volume methods – II. Relativistic hydro- and magnetohydrodynamics. In this work, we discuss the extension of the XTROEM-FV code to relativistic hydrodynamics and magnetohydrodynamics. XTROEM-FV is a simulation package for computational astrophysics based on very high order finite-volume methods on Cartesian coordinates. Arbitrary spatial high order of accuracy is achieved with a weighted essentially non-oscillatory (WENO) reconstruction operator, and the time evolution is carried out with a strong stability preserving Runge–Kutta scheme. In XTROEM-FV has been implemented a cheap, robust, and accurate shock-capturing strategy for handling complex shock waves problems, typical in an astrophysical environment. The divergence constraint of the magnetic field is tackled with the generalized Lagrange multiplier divergence cleaning approach. Numerical computations of smooth flows for the relativistic hydrodynamics and magnetohydrodynamics equations are performed and confirm the high-order accuracy of the main reconstruction algorithm for such kind of flows. XTROEM-FV has been subject to a comprehensive numerical benchmark, especially for complex flows configurations within an astrophysical context. Computations of problems with shocks with very high order reconstruction operators up to seventh order are reported. For instance, one-dimensional shock tubes problems for relativistic hydrodynamics and magnetohydrodynamics, as well as two-dimensional flows like the relativistic double Mach reflection problem, the interaction of a shock wave with a bubble, the relativistic Orszag–Tang vortex, the cylindrical blast wave problem, the rotor problem, the Kelvin–Helmholtz instability, and an astrophysical slab jet. XTROEM-FV represents a new attempt to simulate astrophysical flow phenomena with very high order numerical methods.