Applications of atomic force microscopy (AFM) to the fabrication of chemical nanosensors are presented in this paper. Using AFM cantilever as cathode, the surface of Ti thin film is oxidized to form a few tens of nanometers wide oxidized metal semiconductor wire, which works as a nanowire-based hydrogen sensor. The reaction mechanism is proposed. The AFM observations of fabrication of a TiO2 nanowire are carried out. The sensitive characteristic of such TiO2 nanowires to hydrogen is investigated.