Phospholipids have major roles in the structure and function of all cell membranes. Most integral membrane proteins from the large CDP-alcohol phosphatidyltransferase family are involved in phospholipid biosynthesis across the three domains of life. They share a conserved sequence pattern and catalyse the displacement of CMP from a CDP-alcohol by a second alcohol. Here we report the crystal structure of a bifunctional enzyme comprising a cytoplasmic nucleotidyltransferase domain (IPCT) fused with a membrane CDP-alcohol phosphotransferase domain (DIPPS) at 2.65 Å resolution. The bifunctional protein dimerizes through the DIPPS domains, each comprising six transmembrane α-helices. The active site cavity is hydrophilic and widely open to the cytoplasm with a magnesium ion surrounded by four highly conserved aspartate residues from helices TM2 and TM3. We show that magnesium is essential for the enzymatic activity and is involved in catalysis. Substrates docking is validated by mutagenesis studies, and a structure-based catalytic mechanism is proposed.