The spectra of three-photon laser excitation (according to the 5S1/2 ® 5P3/2 ® 6S1/2 ® 37P3/2 scheme) of mesoscopic ensembles of cold Rb Rydberg atoms in a magneto-optical trap, using cw single-frequency lasers in each stage, have been investigated. The ensembles consisted of 1 to 5 atoms, and their presence was recorded by the selective field ionisation method with postselection according to the number of atoms. The dependence of the spectral shape on the excitation laser pulse duration has been studied. For 2-ms pulses, the minimum spectral width was found to be 1.3 MHz; it was determined by the laser linewidth and the spectral width of laser pulse. For pulses shorter than 0.5 ms, additional spectral broadening and occurrence of Rabi oscillations in the wings of three-photon resonances have been observed, a fact indicative of implementation of coherent three-photon laser excitation of Rydberg atoms. An analysis of the spectra within the four-level theoretical model based on optical Bloch equations showed good agreement between the experimental and theoretical results. The dependence of the shape of three-photon excitation spectrum on the number of recorded atoms was also studied. An increase in the average number of atoms leads to the occurrence of a dip in the single-atom excitation spectra; this dip is due to the specificity of the excitation and detection statistics of Rydberg atoms. The results obtained are important for applications of Rydberg atoms in quantum informatics.