A nanocomposite of polyaniline (PANI)/mesoporous tungsten trioxide (m-WO3) was synthesized by the chemical oxidation polymerization of aniline coated onto an ordered m-WO3 and investigated as an anode material for lithium-ion batteries. The nanocomposite was characterized by using X-ray diffraction, Fourier transform infrared spectroscopy, thermogravimetric analysis, scanning electron microscopy, and transmission electron microscopy. The electrochemical properties of the nanocomposite were evaluated by cyclic voltammetry and constant current charge/discharge tests. The reversible capacity of the PANI/m-WO3 in the first cycle was 1064 mAh g−1 at 60 mA g−1 and remained at 803 mAh g−1 at 180 mA g−1 after 100 cycles, while the initial charge capacity of m-WO3 was 556 mAh g−1 and remained only at 303 mAh g−1 after 50 cycles. The improved electrochemical performance of the nanocomposite can be ascribed to the electronical conductivity of PANI and the chemical interaction between PANI and m-WO3. More importantly, the unique PANI coating layer on the m-WO3 is believed to play an important role in the capacity contribution of the composite.