Background: Umbilical cord infection (omphalitis) is a risk factor for neonatal sepsis and mortality in low-resource settings where home deliveries are common. We aimed to assess the effect of umbilical-cord cleansing with 4 chlorhexidine (CHX) solution, with or without handwashing with antiseptic soap, on the incidence of omphalitis and neonatal mortality. Methods: We did a two-by-two factorial, cluster-randomised trial in Dadu, a rural area of Sindh province, Pakistan. Clusters were defined as the population covered by a functional traditional birth attendant (TBA), and were randomly allocated to one of four groups (groups A to D) with a computer-generated random number sequence. Implementation and data collection teams were masked to allocation. Liveborn infants delivered by participating TBAs who received birth kits were eligible for enrolment in the study. One intervention comprised birth kits containing 4 CHX solution for application to the cord at birth by TBAs and once daily by family members for up to 14 days along with soap and educational messages promoting handwashing. One intervention was CHX solution only and another was handwashing only. Standard dry cord care was promoted in the control group. The primary outcomes were incidence of neonatal omphalitis and neonatal mortality. The trial is registered with ClinicalTrials.gov, number NCT00682006. Findings: 187 clusters were randomly allocated to one of the four study groups. Of 9741 newborn babies delivered by participating TBAs, factorial analysis indicated a reduction in risk of omphalitis with CHX application (risk ratio [RR]=0·58, 95 CI 0·41-0·82; p=0·002) but no evidence of an effect of handwashing (RR=0·83, 0·61-1·13; p=0·24). We recorded strong evidence of a reduction in neonatal mortality in neonates who received CHX cleansing (RR=0·62, 95 CI 0·45-0·85; p=0·003) but no evidence of an effect of handwashing promotion on neonatal mortality (RR=1·08, 0·79-1·48; p=0·62). We recorded no serious adverse events. Interpretation: Application of 4 CHX to the umbilical cord was effective in reducing the risk of omphalitis and neonatal mortality in rural Pakistan. Provision of CHX in birth kits might be a useful strategy for the prevention of neonatal mortality in high-mortality settings. Funding: The United States Agency for International Development.