A superconducting transition-edge sensor (TES) as a microcalorimeter detects incoming photons by measuring heat converted from photon energy. With high resolving power and low noise levels, a TES is sensitive to single photons and able to count photons within a wide spectral band from X-ray to near-infrared. We have developed a TES detector aiming at soft X-ray spectroscopy applications. In this work, the performance of this detector is characterized. It is shown that the energy resolution of this detector is about 1.8 eV for 1.5 keV photons. The good resolution is also kept in visible range, enabling photon-number resolving for 405 nm photons.