The application of molecules in technological devices hinges on the proper understanding of their behavior on metallic electrodes or substrates. The intrinsic molecular electronic and magnetic properties are modified at a metallic interface, and greatly depend on the atomic configuration of the molecule-metal bond. This poses certain problems, such as the lack of reproducibility in the transport properties of molecular junctions, but also offers the possibility to induce new charge and spin configurations that are only present at the interface. The results presented in this thesis address this issue, providing a comprehensive overview of the influence of molecule-metal and molecule-molecule interactions on the electronic and magnetic properties of molecules adsorbed on metallic substrates. Using metal-phthalocyanines (MePc), a commonly used metal-organic complex as a model system, each chapter explores different aspects of the interaction with silver surfaces: the local adsorption geometry, self-assembly, the modifications of the electronic and magnetic characteristics due to hybridization and charge transfer, and finally the manipulation of molecular charge and spin states by electron doping using alkali atoms moved with the STM tip.