A detailed reaction mechanism for methanol combustion that is capable of describing ignition, flame propagation and species concentration profiles with high accuracy has been developed. Starting from a modified version of the methanol combustion mechanism of Li et al. (Int. J. Chem. Kinet. 2007) and adopting the H2/CO base chemistry from the joint optimized hydrogen and syngas combustion mechanism of Varga et al. (Int. J. Chem. Kinet., 2016), an optimization of 57 Arrhenius parameters of 17 important elementary reactions was performed, using several thousand indirect measurement data points, as well as direct and theoretical determinations of reaction rate coefficients as optimization targets. The final optimized mechanism was compared to 18 reaction mechanisms published in recent years, with respect to their accuracy in reproducing the available indirect experimental data for methanol and formaldehyde combustion. The utilized indirect measurement data, in total 24,900 data points in 265 datasets, include measurements of ignition delay times, laminar burning velocities and species profiles captured using a variety of experimental techniques. In addition to new best fit values for all rate parameters, the covariance matrix of the optimized parameters, which provides a quantitative description of the temperature-dependent ranges of uncertainty for the optimized rate coefficients, was calculated. These posterior uncertainty limits are much narrower than the prior limits in the temperature range for which experimental data are available. The uncertainty of the self-reaction of HȮ2 radicals and important H-atom abstraction reactions from the methanol molecule are discussed in detail.