As an effective physical field feature to perceive ferromagnetic targets, magnetic anomaly is widely used in covert marine surveillance tasks. However, its practical usability is affected by the complex marine magnetic noise interference, making robust magnetic anomaly detection (MAD) quite a challenging task. Recently, learning-based detectors have been widely studied for the discrimination of magnetic anomaly signal and achieve superior performance than traditional rule-based detectors. Nevertheless, learning-based detectors require abundant data for model parameter training, which are difficult to access in practical marine applications. In practice, target magnetic anomaly data are usually expensive to acquire, while rich marine magnetic noise data are readily available. Thus, there is an urgent need to develop effective models to learn discriminative features from the abundant marine magnetic noise data for newly appearing target anomaly detection. Motivated by this, in this paper we formulate MAD as a single-edge detection problem and develop a self-supervised marine noise learning approach for target anomaly classification. Specifically, a sparse autoencoder network is designed to model the marine noise and restore basis geomagnetic field from the collected noisy magnetic data. Subsequently, reconstruction error of the network is used as a statistical decision criterion to discriminate target magnetic anomaly from cluttered noise. Finally, we verify the effectiveness of the proposed approach on real sea trial data and compare it with seven state-of-the-art MAD methods on four numerical indexes. Experimental results indicate that it achieves a detection accuracy of 93.61% and has a running time of 21.06 s on the test dataset, showing superior MAD performance over its counterparts.