Introduction: Late HIV diagnosis is associated with increased morbidity, mortality and risk of onward transmission. Increasing HIV early diagnosis is still a priority. In this observational study with historical control, we determined the impact of an opportunistic HIV screening strategy in the reduction of late diagnosis and missed opportunities for earlier diagnosis. Methods: The screening programme was implemented in the emergency department (ED) of the Hospital de Cascais between September 2018 and September 2021. Eligible patients were aged 18-64 years, with no known HIV diagnosis or antibody testing performed in the previous year, and who required blood work for any reason. Out of the 252 153 emergency visits to the ED, we identified 43 153 (17.1%) patients eligible for HIV testing. Among the total population eligible for the screening, 38 357 (88.9%) patients were ultimately tested for HIV. Impact of the ED screening was determined by analysing late diagnosis in the ED and missed opportunities at different healthcare settings 3 years before and 3 years after the start of the ED screening. Results: After 3 years of automated HIV ED testing, we found 69 newly diagnosed HIV cases (54% male, 39% Portuguese nationals, mean age 40.5 years). When comparing the characteristics of HIV diagnoses made in the ED, we observed a significant reduction in the number of people with late HIV diagnosis before and after implementation of the screening programme (78.4% vs. 39.1%, respectively; p = 0.0291). The mean number of missed opportunities for diagnosis also fell (2.6 vs. 1.5 annual encounters with the healthcare system per patient, p = 0.0997). Conclusions: People living with HIV in Cascais and their providers miss several opportunities for earlier diagnosis. Opportunistic screening strategies in settings previously deemed to be unconventional, such as EDs, are feasible and effective in mitigating missed opportunities for timely HIV diagnosis.Inês Vaz-Pinto and Ana Gorgulho contributed equally to this work.