Nanostructured polyaniline (PANI)–WO3 hybrid thin films were synthesized via a molecular assembling route in a solution of aniline using peroxotungstic acid (PTA) as the dopant and ammonium persulfate as the oxidant. The films show a porous morphology with nanorod arrays on the surface, and WO3 is uniformly incorporated into the polymer network. Electrochemical and electrochromic tests including cyclic voltammetry, chronoamperometry and corresponding in situ transmittance of PANI–WO3 hybrid films compared with neat PANI film and sol–gel WO3 film were conducted in 0.5 M sulfuric acid solution. The hybrid films, being a dual electrochromic material, varied from royal purple to green, pale yellow and finally dark blue as the applied potential was scanned from 0.8 V to −0.5 V. Compared to sulfate doped PANI film, high colouration efficiency and comparable durability are obtained in the PANI–WO3 hybrid films. The PANI–WO3 hybrid films also show faster switching speed and better durability than WO3 film. The enhanced electrochromic properties such as faster switching speed and better durability are mainly attributed to the combining of advantages of both materials and the formation of the donor–acceptor system.