Covering more than 70% of tropical and subtropical coastlines, mangrove intertidal forests are well known to accumulate potentially toxic trace metals in their sediments, and thus are generally considered to play a protective role in marine and lagoon ecosystems. However, the chemical forms of these trace metals in mangrove sediments are still not well known, even though their molecular-level speciation controls their long-term behavior. Here we report the vertical and lateral changes in the chemical forms of nickel, which accumulates massively in mangrove sediments downstream from lateritized ultramafic deposits from New Caledonia, where one of nature's largest accumulations of nickel occurs. To accomplish this we used Ni K-edge Extended X-ray Absorption Fine Structure (EXAFS) spectroscopy data in combination with microscale chemical analyses using Scanning Electron Microscopy coupled with Energy-Dispersive X-ray Spectroscopy (SEM-EDXS). After Principal Component and Target Transform analyses (PCA-TT), the EXAFS data of the mangrove sediments were reliably least-squares fitted by linear combination of 3-components chosen from a large model compound spectral database including synthetic and natural Ni-bearing sulfides, clay minerals, oxyhydroxides, and organic complexes. Our results show that in the inland salt flat Ni is hosted in minerals inherited from the eroded lateritic materials, i.e. Ni-poor serpentine (44-58%), Ni-rich talc (20-31%), and Ni-goethite (18-24%). In contrast, in the hydromorphic sediments beneath the vegetated Avicennia and Rhizophora stands, a large fraction of Ni is partly redistributed into a neoformed smectite pool (20-69% of Ni-montmorillonite), and Ni speciation significantly changes with depth in the sediment. Indeed, Ni-rich talc (25-56%) and Ni-goethite (15-23%) disappear below similar to 15 cm depth in the sediment and are replaced by Ni-sorbed pyrite (23-52%) in redox-active intermediate depth layers and by pyrite (34-55%) in the deepest sediment layers. Ni-incorporation in pyrite is especially observed beneath an inland Avicennia stand where anoxic conditions are dominant. In contrast, beneath a Rhizophora stand closer to the ocean, where the redox cycle is intensified due to the tide cycle, partial re-oxidation of Ni-bearing pyrites favors nickel mobility, as confirmed by Ni-mass balance estimates and by higher Ni concentration in the pore waters. These findings have important environmental implications for better evaluating the protective role of mangroves against trace metal dispersion into marine ecosystems. They may also help in predicting the response of mangrove ecosystems to increasing anthropogenic pressure on coastal areas.