In humans, septal defects are among the most prevalent congenital heart diseases, but their cellular and molecular origins are not fully understood. We report that transcription factor Tbx5 is present in a subpopulation of endocardial cells and that its deletion therein results in fully penetrant, dose-dependent atrial septal defects in mice. Increased apoptosis of endocardial cells lacking Tbx5, as well as neighboring TBX5-positive myocardial cells of the atrial septum through activation of endocardial NOS (Nos3), is the underlying mechanism of disease. Compound Tbx5 and Nos3 haploinsufficiency in mice worsens the cardiac phenotype. The data identify a pathway for endocardial cell survival and unravel a cell-autonomous role for Tbx5 therein. The finding that Nos3, a gene regulated by many congenital heart disease risk factors including stress and diabetes, interacts genetically with Tbx5 provides a molecular framework to understand gene-environment interaction in the setting of human birth defects.