A counting x-ray detector includes, in a stack arrangement, a converter element for conversion of x-ray radiation into electrical charges and an electrode. The electrode is connected to the converter element electrically-conductively in a planar manner. The electrode is embodied at least partly transparently. The electrode includes the following layers: an electrically-conductive contact layer, an electrically-conductive first intermediate layer, an electrically-conductive high-voltage layer, and an illumination layer.