A magnetic photoresponsive hybrid material is prepared by intercalation of a switchable trans-azobenzene-4,4'-dicarboxylate guest in the interlamellar space offered by a ferromagnetic Co(2+)Al(3+)-layered double hydroxide (LDH) host. Magnetic switching is triggered by compression/modification of the in-plane structure coupled the guest's isomerization causing a change in the magnetization of 27%.