A model for generating x-ray spectra of a diagnostic x-ray tube is presented. Electron and Photon transport is simulated by means of the general-purpose Monte Carlo code PENELOPE, using the standard, detailed simulation scheme. Both bremsstrahlung and characteristic x-ray production were included in the model. The simulated x-ray spectra were compared with spectra generated by Spektr (Spektr is a computational tool for x-ray spectral analysis and imaging system optimization based on TASMIP program) at different kVp and filter thickness and good agreements were observed. The Monte Carlo method is a convenient and accurate tool allowing the calculation of spectra possessing the essential features of real spectra. These and other spectra will be used in future work to study the influence of x-ray spectrum on dose and image quality for various x-ray CT system configurations.