In vivo non-linear optical microscopy has been essential to advance our knowledge of how intact biological systems work. It has been particularly enabling to decipher fast spatiotemporal cellular dynamics in neural networks. The power of the technique stems from its optical sectioning capability that in turn also limits its application to essentially immobile tissue. Only tissue not affected by movement or in which movement can be physically constrained can be imaged fast enough to conduct functional studies at high temporal resolution. Here, we show dynamic two-photon Ca(2+) imaging in the spinal cord of a living rat at millisecond time scale, free of motion artifacts using an optical stabilization system. We describe a fast, non-contact adaptive movement compensation approach, applicable to rough and weakly reflective surfaces, allowing real-time functional imaging from intrinsically moving tissue in live animals. The strategy involves enslaving the position of the microscope objective to that of the tissue surface in real-time through optical monitoring and a closed feedback loop. The performance of the system allows for efficient image locking even in conditions of random or irregular movements.