Mycotoxins are the secondary toxic metabolites produced naturally by fungi. Analysis of mycotoxins is essential to minimize the consumption of contaminated food and feed. In this present work, an ultrasensitive electrochemical immunosensor for the detection of aflatoxin B1 (AFB1) was successfully developed based on an indirect competitive enzyme-linked immunosorbent assay (ELISA). Various parameters of ELISA, including antigen-antibody concentration, blocking agents, incubation time, temperature and pH of reagents, were first optimized in a 96-well microtiter plate to study the antigen-antibody interaction and optimize the optimum parameters of the assay. The optimized assay was transferred onto the multi-walled carbon nanotubes/chitosan/screen-printed carbon electrode (MWCNTs/CS/SPCE) by covalent attachment with the aid of 1-Ethyl-3-(3-dimetylaminopropyl)-carbodiimide (EDC) and N-hydroxysuccinimide (NHS). Competition occurred between aflatoxin B1-bovine serum albumin (AFB1-BSA) and free AFB1 (in peanut sample and standard) for the binding site of a fixed amount of anti-AFB1 antibody. Differential pulse voltammetry (DPV) analysis was used for the detection based on the reduction peak of TMB(ox). The developed immunosensor showed a linear range of 0.0001 to 10 ng/mL with detection limit of 0.3 pg/mL. AFB1 analysis in spiked peanut samples resulted in recoveries between 80% and 127%. The precision of the developed immunosensor was evaluated by RSD values (n = 5) as 4.78% and 2.71% for reproducibility and repeatability, respectively.