This paper presents a novel Lagrangian approach to attitude tracking for rigid spacecraft using unit quaternions, where the motion equations of a spacecraft are described by a four degrees of freedom Lagrangian dynamics subject to a holonomic constraint imposed by the norm of a unit quaternion. The basic energy-conservation property as well as some additional useful properties of the Lagrangian dynamics are explored, enabling to develop quaternion-based attitude tracking controllers by taking full advantage of a broad class of tracking control designs for mechanical systems based on energy-shaping methodology. Global tracking of a desired attitude on the unit sphere is achieved by designing control laws that render the tracking error on the four-dimensional Euclidean space to converge to the origin. The topological constraints for globally exponentially tracking by a quaternion-based continuous controller and singularities in controller designs based on any three-parameter representation of the attitude are then avoided. Using this approach, a full-state feedback controller is first developed, and then several important issues, such as robustness to noise in quaternion measurements, unknown on-orbit torque disturbances, uncertainty in the inertial matrix, and lack of angular-velocity measurements are addressed progressively, by designing a hybrid statefeedback controller, an adaptive hybrid state-feedback controller, and an adaptive hybrid attitude-feedback controller. Global asymptotic stability is established for each controller. Simulations are included to illustrate the theoretical results.