A variational symplectic integrator for the guiding-center motion of charged particles in general magnetic fields is developed for long-time simulation studies of magnetized plasmas. Instead of discretizing the differential equations of the guiding-center motion, the action of the guiding-center motion is discretized and minimized to obtain the iteration rules for advancing the dynamics. The variational symplectic integrator conserves exactly a discrete Lagrangian symplectic structure, and has better numerical properties over long integration time, compared with standard integrators, such as the standard and variable time-step fourth order Runge-Kutta methods.