A sensitive electrochemical sensor was developed by modifying a glassy carbon electrode (GCE) with hematoxylin and MWCNTs/Fe3O4/TiO2 nanocomposite for the improved detection of methyldopa in the presence of folic acid. Electrochemical methods such as cyclic voltammetry (CV), differential pulse voltammetry (DPV) and chronoamperometry (CHA) were used to describe the electrochemical performance of the hematoxylin–MWCNTs/Fe3O4/TiO2/GCE for methyldopa and folic acid sensing studies. Methyldopa and folic acid were detected by DPV method at 190 and 720 mV, respectively. Due to the synergistic effect of the hematoxylin and MWCNTs/Fe3O4/TiO2 nanocomposite, the modified electrode exhibited good sensing performance to methyldopa and folic acid in the range of 0.5–300 μM with detection limit of 0.02 μM. Also, this method was applied for the quantification of methyldopa and folic acid in real samples.