Surface etching of the layered compound 1T-TaS2 with a STM tip was observed in an ultrahigh vacuum where the true vacuum tunneling gap was achieved. The etching did not always progress in a layer-by-layer manner, but etch-pits often had the depths of multiples of the unit layer. The etching rate on a clean surface was much slower than that on a surface once exposed to the ambient air, which showed a rough and irregular nano-scale morphology, implying that the surface of 1T-TaS2 is chemically degraded by the water vapor in air. On a clean surface, the STM etching started from the defect-like sites seen on the STM image, which possibly reflect the substrate impurities located on the Ta planes or van der Waals gaps, and progressed preferably in the scanning direction. The etching rate tended to increase with the bias voltage, regardless of its sign. This suggests that the electrostatic attractive force between tip atoms and surface atoms and/or the current-induced local heating contribute significantly to the STM etching of 1T-TaS2 in ultrahigh vacuum.