In the X-ray region, there exist optical elements analogous to lenses and mirrors for visible light. For visible light, a variable focusing power can be achieved by Alvarez lenses which consist of a pair of inline planar refractors with a cubic thickness profile, which when laterally displaced in opposite directions result in a parabolic component to the wavefront. This paper reports an implementation of this concept for X-rays using two planar microfabricated refractive elements which when used in conjunction with an elliptical mirror focusing system allowed the focal plane to be moved by up to 2 mm with high precision and within milli-seconds. The study presents the first working proof of an Alvarez lens for the adaptive correction of astigmatism and defocus aberrations of X-ray optics.