Reversible protein palmitoylation regulates many aspects of cell function and is largely carried out by zf-DHHC containing proteins. However, the in vivo physiological function of protein palmitoylation is largely unknown. To address this question, we generated Aph2-/-(zf-DHHC16) mice, revealing an essential role for Aph2 in postnatal survival and heart development, evidenced by histological/electrophysiological defects and neonatal onset of cardiomyopathy and heart failure. Aph2 is shown to be a palmitoyl acyltransferase for phospholamban, where palmitoylation on cysteine 36 promotes phospholamban nucleus envelope localization, its interaction with PKA, and subsequent serine 16 phosphorylation. Aph2 deficiency led to phospholamban hypophosphorylation, defects in phospholamban pentamer formation and Ca2+ homeostasis. Deletion of phospholamban in Aph2-/- mice rescued several of the heart phenotypes. These findings establish that Aph2 is a critical in vivo regulator of heart contractile function, partially via the modification of phospholamban, thereby identifying a novel therapeutic target for cardiomyopathy and heart failure.