In the present study, indium tin oxide (ITO) was used as a transparent working electrode for the development of an electrochemical sensor for the detection of mercury (II) ions (Hg2+). The electrode was modified by direct electrodeposition of polyaniline (PANI), multiwalled carbon nanotubes (MWCNTs) and gold nanoparticles (AuNPs) followed by optimization of the analyte and operating conditions, aiming to improve the selectivity, sensitivity and reliability of the electrode for mercury detection. Successful immobilization of the PANI and nanomaterials (MWCNTs and AuNPs) on the ITO electrode was confirmed by Scanning Electron Microscope (SEM), Energy Dispersive X-ray (EDX) and Fourier Transform Infrared Spectroscopy (FTIR) analyses. The optimum conditions for mercury detection using the modified ITO electrode were pH 7.0 of Tris-HCl buffer (50 mM) in the presence of 1 mM methylene blue (MB) as a redox indicator, a scan rate of 0.10 V·s−1 and a 70 s interaction time. The electrochemical behavior of the modified electrode under the optimized conditions indicated a high reproducibility and high sensitivity of mercury detection. It is therefore suggested that the PANI/MWCNT/AuNP-modified ITO electrode could be a promising material for the development of on-site mercury detection tools for applications in fields such as diagnostics, the environment, safety and security controls or other industries.