To describe reported changes in sexual behaviours, including virtual sex (sexting and cybersex), and access to HIV/STI testing and care during COVID-19 measures in Panama. We conducted an online cross-sectional survey from 8 August to 12 September 2020 among adults (≥18 years) residing in Panama. Participants were recruited through social media. Questions included demographics, access to HIV/STI testing and HIV care, and sexual behaviours 3 months before COVID-19 social distancing measures and during social distancing measures (COVID-19 measures). Logistic regression was used to identify associations between variables and behavioural changes. We recruited 960 participants; 526 (54.8%) identified as cis-women, 366 (38.1%) cis-men and 68 (7.1%) non-binary or another gender. The median age was 28 years (IQR: 23-37 years), and 531 of 957 (55.5%) were of mixed ethnicity (mixed Indigenous/European/Afro-descendant ancestry). Before COVID-19 measures, virtual sex was reported by 38.5% (181 of 470) of cis-women, 58.4% (184 of 315) cis-men and 45.0% (27 of 60) non-binary participants. During COVID-19 measures, virtual sex increased among 17.2% of cis-women, 24.7% cis-men and 8.9% non-binary participants. During COVID-19 measures, 230 of 800 (28.8%) participants reported decreased casual sex compared with pre-COVID-19 measures. Compared with pre-COVID-19 measures, decreased casual sex was reported more frequently during COVID-19 measures by cis-men compared with cis-women (39.2% vs 22.9%, urban/rural adjusted OR (AOR)=2.17, 95% CI 1.57 to 3.01), and by Afro-descendant compared with participants of mixed ethnicity (40.0% vs 29.8%, AOR=1.78, 95% CI 1.07 to 2.94). Compared with no change in virtual sex (16.8%), increased virtual sex (38.5%, AOR=1.78, 95% CI 1.10 to 2.88) and decreased virtual sex (86.7%, AOR=16.53, 95% CI 7.74 to 35.27) were associated with decreased casual sex encounters. During COVID-19 measures, HIV/STI testing could not be obtained by 58.0% (58 of 100) of the participants who needed a test, and interrupted HIV care was reported by 53.3% (8 of 15) of participants living with HIV. COVID-19 measures in Panama were associated with a decrease in casual sex among cis-men and Afro-descendant people, while access to HIV/STI testing and care was seriously disrupted. © Author(s) (or their employer(s)) 2022. No commercial re-use. See rights and permissions. Published by BMJ.