Background: Yaws is a substantial cause of chronic disfiguring ulcers in children in at least 14 countries in the tropics. WHO's newly adopted strategy for yaws eradication uses a single round of mass azithromycin treatment followed by targeted treatment programmes, and data from pilot studies have shown a short-term significant reduction of yaws. We assessed the long-term efficacy of the WHO strategy for yaws eradication. Methods: Between April 15, 2013, and Oct 24, 2016, we did a longitudinal study on a Papua New Guinea island (Lihir; 16 092 population) in which yaws was endemic. In the initial study, the participants were followed for 12 months; in this extended follow-up study, clinical, serological, and PCR surveys were continued every 6 months for 42 months. We used genotyping and travel history to identify importation events. Active yaws confirmed by PCR specific for Treponema pallidum was the primary outcome indicator. The study is registered with ClinicalTrials.gov, number NCT01955252. Findings: Mass azithromycin treatment (coverage rate of 84%) followed by targeted treatment programmes reduced the prevalence of active yaws from 1·8% to a minimum of 0·1% at 18 months (difference from baseline -1·7%, 95% CI, -1·9 to -1·4; p<0·0001), but the infection began to re-emerge after 24 months with a significant increase to 0·4% at 42 months (difference from 18 months 0·3%, 95% CI 0·1 to 0·4; p<0·0001). At each timepoint after baseline, more than 70% of the total community burden of yaws was found in individuals who had not had the mass treatment or as new infections in non-travelling residents. At months 36 and 42, five cases of active yaws, all from the same village, showed clinical failure following azithromycin treatment, with PCR-detected mutations in the 23S ribosomal RNA genes conferring resistance to azithromycin. A sustained decrease in the prevalence of high-titre latent yaws from 13·7% to <1·5% in asymptomatic children aged 1-5 years old and of genetic diversity of yaws strains from 0·139 to less than 0·046 between months 24 and 42 indicated a reduction in transmission of infection. Interpretation: The implementation of the WHO strategy did not, in the long-term, achieve elimination in a high-endemic community mainly due to the individuals who were absent at the time of mass treatment in whom yaws reactivated; repeated mass treatment might be necessary to eliminate yaws. To our knowledge, this is the first report of the emergence of azithromycin-resistant T p pertenue and spread within one village. Communities' surveillance should be strengthened to detect any possible treatment failure and biological markers of resistance. Funding: ISDIN laboratories, Newcrest Mining Limited, and US Public Health Service National Institutes of Health.