The magnetic properties of metal–organic complexes are strongly influenced by conformational changes in the ligand. The flexibility of Fe-tetra-pyridyl-porphyrin molecules leads to different adsorption configurations on a Au(111) surface. By combining low-temperature scanning tunneling spectroscopy and atomic force microscopy, we resolve a correlation of the molecular configuration with different spin states and magnitudes of magnetic anisotropy. When the macrocycle exhibits a laterally undistorted saddle shape, the molecules lie in a S = 1 state with axial anisotropy arising from a square-planar ligand field. If the symmetry in the molecular ligand field is reduced by a lateral distortion of the molecule, we find a finite contribution of transverse anisotropy. Some of the distorted molecules lie in a S = 2 state, again exhibiting substantial transverse anisotropy