Legged robots have received extensive attention due to their strong ability to adapt to complex terrain. The multi-link mechanism has great flexibility of motion and has been greatly applied in the design of the leg structure of the legged robot. To utilize the benefit, a novel leg mechanism of legged robot with two degree of freedom (DoF) based on nine-bar linkage is proposed. The geometric mathematical equation of the nine-bar mechanism is established by the vector ring method. The displacement equation of the mechanism is deduced by the method of combining coordinate transformation and matrix operation. The displacement, velocity and acceleration of the nine-bar mechanism are easily analyzed by using the matrix method. Thus, the kinematic model of the robot’s leg structure is obtained. The research in this paper can lay the foundation for the kinematic design and dynamic analysis of the mechanism. The matrix motion analysis method adopted by this paper can provide a reference for the motion analysis of similar mechanisms.