Coronavirus disease 2019 (COVID-19) is a highly contagious illness caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2), resulting in a global health crisis. The primary diagnostic method for COVID-19 is quantitative reverse transcription PCR, which is time-consuming and requires expensive instrumentation. Here, we developed an electrochemical biosensor for detecting SARS-CoV-2 biomarkers using a 3D porous polyacrylamide/polyaniline hydrogel (PPG) electrode prepared by UV photopolymerization and in situ polymerization. The electrochemical immunosensor for detecting SARS-CoV-2 N protein via the immune sandwich principle demonstrated a lower detection limit of 42 pg/mL and comparable specificity to a commercial enzyme-linked immunosorbent assay, which was additionally validated in pseudoviruses. The electrochemical sensor for hydrogen peroxide showed a low detection limit of 0.5 μM and excellent selectivity, which was further confirmed in cancer cells under oxidative stress. The biomarkers of SARS-CoV-2 were successfully detected due to the signal amplification capability provided by 3D porous electrodes and the high sensitivity of the antigen-antibody specific binding. This study introduces a novel three-dimensional electrode with great potential for the early detection of SARS-CoV-2.