We report a measurement of the time-dependent ratio of D0->K+pi- to D0->K-pi+ decay rates in D*+-tagged events using 1.0 fb^{-1} of integrated luminosity recorded by the LHCb experiment. We measure the mixing parameters x2=(-0.9+-1.3)x10^{-4}, y=(7.2+-2.4)x10^{-3} and the ratio of doubly-Cabibbo-suppressed to Cabibbo-favored decay rates R_D=(3.52+-0.15)x10^{-3}, where the uncertainties include statistical and systematic sources. The result excludes the no-mixing hypothesis with a probability corresponding to 9.1 standard deviations and represents the first observation of D0-D0bar oscillations from a single measurement.