We present a combined low-temperature scanning tunneling microscopy and near-edge X-ray adsorption fine structure study on the interaction of tetrapyridyl-porphyrin (TPyP) molecules with a Cu-(111) surface. A novel approach using data from complementary experimental techniques and charge density calculations allows us to determine the adsorption geometry of TPyP on Cu(111). The molecules are centered on "bridge" sites of the substrate lattice and exhibit a strong deformation involving a saddle-shaped macrocycle distortion as well as considerable rotation and tilting of the meso-substituents. We propose a bonding mechanism based on the pyridyl-surface interaction, which mediates the molecular deformation upon adsorption. Accordingly, a functionalization by pyridyl groups opens up pathways to control the anchoring of large organic molecules on metal surfaces and tune their conformational state. Furthermore, we demonstrate that the affinity of the terminal groups for metal centers permits the selective capture of individual iron atoms at low temperature.