New XRD total pattern fitting software MSTRUCT was used to study the microstructure of magnetron-deposited TiO2 thin films. MSTRUCT is an extension of the FOX program for structure determination from powder diffraction data. MSTRUCT makes corrections for refraction and absorption, residual stress, and preferred orientation that are necessary for thin-film analysis using the parallel-beam geometry and an asymmetric detector scan with small angles of incidence. The program also corrects for crystallite size broadening in terms of log-normal distribution, two models of strain (phenomenological and dislocation models), as well as the influence of stacking faults in the most common cubic and hexagonal structures. The microstructure results obtained by this study show that during crystallization of the amorphous TiO2 films, tensile stresses were generated resulting in anisotropic shifts of diffraction peaks. This was confirmed by in situ crystallization and direct stress measurements. The consideration of the stress effect in terms of the weighted Reuss-Voigt model improved the fits significantly. The stresses were found to depend systematically on the TiO2 film thickness, and their values determined by total pattern fitting agree well with the values measured directly by XRD stress analysis.