All ships operating under SOLAS regulations must carry a properly adjusted Class A magnetic compass. In addition, all vessels over 150 gross tonnes must also have a spare compass which should be interchangeable with the main compass.
(SOLAS Chapter V: Safety of Navigation Regulation 19)