Attitude information obtained from low-cost magnetic, angular rate, and gravity (MARG) sensors is prone to be deteriorated by disturbances such as external acceleration and magnetic anomaly in operational environments. To address the problem, a robust attitude estimation algorithm using low-cost MARG sensors is proposed. An error state Kalman filter (ESKF) is used for data fusing, in which the attitude errors are interpreted as a small rotation vector, and the gyro bias variation is also estimated. The nominal state and the error state are propagated with unit quaternion and rotation vector, respectively. An attitude correction is followed which combines the nominal and error parts by quaternion multiplication. The robustness of the proposed algorithm is embodied in resisting accuracy degradation of the attitude estimation caused by both external acceleration and magnetic anomalies. While external accelerations and magnetic disturbances are detected online, the accuracy reduction in attitude estimation is prevented by adaptively adjusting the related measurement noise covariance matrix. Besides, a two-step measurement update strategy is designed to guarantee that the roll and pitch update is separated from the yaw update. Various rotation and land vehicle dynamic tests have been conducted to validate the effectiveness and robustness of the proposed algorithm.