We present a scheme to measure the thermal conductivity of individual nanowires using temperature-dependent and microphotoluminescence spectroscopy. The CdS nanowires suspended over trenches in silicon substrate were excited with a focused laser beam in confocal configuration. The photoluminescence at the laser spot gave a measure of the local temperature rise determined by the excitation laser intensity and the thermal conductance of the nanowires. By obtaining the temperature gradient across the nanowire and the length of the suspended segment, the thermal conductivity of CdS nanowires with diameters in the range of 200–400 nm was extracted to be in the range of 4.9–6.2 W/m K.