The first vertical transmission of HIV prevention (VTP) programme in South Africa was launched in 1999 in Khayelitsha, Western Cape Province (WC). Since then, VTP guidelines have expanded in complexity and scope. To describe contemporary VTP uptake in Khayelitsha and quantify vertical transmission (VT) risk factors based on linked routine electronic health data. In the WC, all patients at public health facilities have a unique identifier allowing linkage across electronic health platforms through a health information exchange hosted within the WC Department of Health. We conducted a cohort analysis of mother-infant pairs where the mother was living with HIV and attended any obstetric care in Khayelitsha in 2017. Descriptive statistics assessed VTP coverage along the care cascade, including maternal viral load (VL) testing and early infant diagnosis (EID). Logistic regression analysis quantified a priori-defined risk factors associated with VT. Antenatal HIV prevalence in the cohort was 31.3%, and VT was 1.8% by 12 months. Of women living with HIV, 88.3% knew of their positive status at the first antenatal visit and 77.9% were already receiving antiretroviral therapy (ART). Most women diagnosed prior to delivery (94.5%) were initiated on ART; 85.0% received an antenatal VL test, of whom 88.0% were virologically suppressed. Women who were not virally suppressed had a five-fold (adjusted odds ratio (aOR) 5.3; 95% confidence interval (CI) 2.5 - 12.3) increased VT risk compared with those who were suppressed. Women who attended no antenatal care were at higher risk of VT (aOR 1.6; 95% CI 0.7 - 3.6) than those who did attend. EID coverage was suboptimal: a birth HIV polymerase chain reaction (PCR) test was available for 79.2% of infants, and a low proportion with a negative birth test had a repeat test around 10 weeks (57.9%). Data linkage identified an additional 15 infants living with HIV who were not detected by HIV-PCR testing alone. Although most women presented to care already knowing their HIV status, ART initiation was suboptimal prior to the first antenatal visit but improved over the course of pregnancy. The VT rate based on laboratory HIV-PCR testing alone underestimated HIV transmission: linked data from multiple sources suggested higher VT than programme-reported rates based on HIV-PCR testing alone.