X-ray spectroscopy with a photon-counting SiPM-based scintillation detector