A nanocomposite of TiO2/Fe3O4/MWCNTs (TFMWCNT) and ionic liquid was used to fabrication of a novel modified carbon paste electrode. The modified electrode was used for voltammetric determination of morphine. The proposed method exhibited wide linear dynamic range of 2.5 × 10–8 to 6.0 × 10–4 M with a detection limit (S/N = 3) of 1.5 × 10–8 M for morphine. Also, the diffusion coefficient (D = 2.83 × 10–6 cm2/s) and electron transfer coefficient (α = 0.31) for morphine oxidation were also determined. The novel sensor was used for simultaneous determination of morphine and diclofenac using square wave voltammetry (SWV). Finally this method was used for determination of morphine and diclofenac in some real samples.