Men who have sex with men (MSM) are disproportionally affected by HIV and drug and alcohol use; however, few effective HIV prevention interventions for MSM who use substances exist. Screening, Brief Intervention, and Referral to Treatment is an early intervention for non-treatment-seeking individuals with problematic substance use and for timely referral to treatment for those with substance use disorders. Electronic screening and brief interventions (e-SBIs) reduce implementation challenges. An e-SBI tailored for MSM at the time of HIV testing might be particularly opportune to strengthen their motivation to reduce substance use and HIV risk behavior. This study aims to develop a tailored e-SBI program to reduce substance use and HIV risk behavior among MSM seeking HIV testing at Nexo Asociación Civil, our community partners in Argentina (primary); assess the feasibility and acceptability of integrating the e-SBI into the Nexo HIV testing program (primary); assess the feasibility and acceptability of implementing an adapted Men's Health Project (MHP) at Nexo (secondary); and finally, explore preliminary findings on substance use and sexual risk reduction outcomes (exploratory). This mixed methods study has 2 stages. During stage 1 (development), we will use the User Centered Rapid App Design process consisting of focus groups (n=16), individual interviews (n=24), and a pilot deployment of the e-SBI (n=50) to iteratively develop the e-SBI. Quantitative and qualitative assessments at each step will inform the revision of the e-SBI. Furthermore, we will use the assessment, decision, administration, production, topic experts, integration, training, testing framework to adapt MHP. During stage 2 (pilot randomized controlled trial [RCT]), we will randomize 200 MSM coming to Nexo for HIV testing. They will complete a baseline assessment and then their assigned intervention (e-SBI vs screening only) and will be followed-up for 6 months. We will also conduct in-depth interviews with up to 45 participants: 15 participants from either study condition who entered or completed MHP or other substance abuse treatment and 15 from each arm who met the criteria for MHP but did not request it. The study began recruitment in October 2022, and the stage-1 pilot study is near completion. Preliminary findings from stage 1 show high e-SBI acceptability. Data analysis of the stage-1 pilot is now beginning. The stage-2 pilot RCT will be launched in March 2024, with all data collection completed by May 2025. This study will allow us to assess the acceptability and feasibility of e-SBI implementation during HIV testing encounters. We will also build the necessary research infrastructure for a subsequent RCT to assess the efficacy of e-SBIs in reducing substance use and HIV sexual risk behavior among MSM in this setting. ClinicalTrials.gov NCT05542914; https://tinyurl.com/yyjj64dm. DERR1-10.2196/56683.