Observed X-ray spectra of hot gas in clusters, groups, and individual galaxies are commonly fit with a single-temperature thermal plasma model even though the beam may contain emission from components with different temperatures. Recently, Mazzotta et al. pointed out that thus derived T_spec can be significantly different from commonly used definitions of average temperature, such as emission- or emission measure-weighted T, and found an analytic expression for predicting T_spec for a mixture of plasma spectra with relatively hot temperatures (T>3 keV). In this Paper, we propose an algorithm which can accurately predict T_spec in a much wider range of temperatures (T>0.5 keV), and for essentially arbitrary abundance of heavy elements. This algorithm can be applied in the deprojection analysis of objects with the temperature and metallicity gradients, for correction of the PSF effects, for consistent comparison of numerical simulations of galaxy clusters and groups with the X-ray observations, and for estimating how emission from undetected components can bias the global X-ray spectral analysis.