We demonstrate here a controllable variation in the Casimir force. Changes in the force of up to 20% at separations of ~100 nm between Au and AgInSbTe (AIST) surfaces were achieved upon crystallization of an amorphous sample of AIST. This material is well known for its structural transformation, which produces a significant change in the optical properties and is exploited in optical data storage systems. The finding paves the way to the control of forces in nanosystems, such as micro- or nanoswitches by stimulating the phase change transition via localized heat sources.