We report on the fabrication of field-effect transistors based on single layers and bilayers of the semiconductor WS2 and the investigation of their electronic transport properties. We find that the doping level strongly depends on the device environment and that long in situ annealing drastically improves the contact transparency, allowing four-terminal measurements to be performed and the pristine properties of the material to be recovered. Our devices show n-type behavior with a high room-temperature on/off current ratio of ∼10(6). They show clear metallic behavior at high charge carrier densities and mobilities as high as ∼140 cm(2)/(V s) at low temperatures (above 300 cm(2)/(V s) in the case of bilayers). In the insulating regime, the devices exhibit variable-range hopping, with a localization length of about 2 nm that starts to increase as the Fermi level enters the conduction band. The promising electronic properties of WS2, comparable to those of single-layer MoS2 and WSe2, together with its strong spin-orbit coupling, make it interesting for future applications in electronic, optical, and valleytronic devices.