Adaptive optics for the human eye has two main applications: to obtain high-resolution images of the retina and to produce aberration-free retinal images to improve vision. Additionally, it can be used to modify the aberrations of the eye to perform experiments to study the visual function. We have developed an adaptive optics prototype by using a liquid crystal spatial light modulator (Hamamatsu Programmable Phase Modulator X8267). The performance of this device both as aberration generator and corrector has been evaluated. The system operated either with red (633nm) or infrared (780nm) illumination and used a real-time Hartmann-Shack wave-front sensor (25 Hz). The aberration generation capabilities of the modulator were checked by inducing different amounts of single Zernike terms. For a wide range of values, the aberration production process was found to be linear, with negligible cross-coupling between Zernike terms. Subsequently, the modulator was demonstrated to be able to correct the aberrations of an artificial eye in a single step. And finally, it was successfully operated in close-loop mode for aberration correction in living human eyes. Despite its slow temporal response, when compared to currently available deformable mirrors, this device presents advantages in terms of effective stroke and mode independence. Accordingly, the programmable phase modulator allows production and compensation of a wide range of aberrations, surpassing in this respect the performance of low-cost mirrors and standing comparison against more expensive devices.