A recently proposed data-driven H2-optimal control approach is demonstrated on a laboratory setup. Most adaptive optics (AO) systems are based on a control law that neglects the temporal evolution of the wavefront. The proposed control approach is able to exploit the spatiotemporal correlation in the wavefront without assuming any form of decoupling. By analyzing the dynamic behavior of the wavefront sensor (WFS), it is shown that if the wavefront correction device can be considered static, the transfer function from control input to WFS output reduces to a two-tap impulse response and an integer number of samples delay. Considering this model structure, a data-driven identification procedure is developed to estimate the relevant parameters from measurement data. The specific structure allows for an analytical expression of the optimal controller in terms of the system matrices of the minimum-phase spectral factor of the atmospheric disturbance model. The performance of the optimal controller is compared with that of the standard AO control law. An analysis of the dominant error sources shows that optimal control may reduce the temporal error. © 2007 Optical Society of America.