Optimal control of a Stewart robot is performed in this paper using a sequential optimal feedback linearization method considering the jack dynamics. One of the most important applications of a Stewart platform is tracking a machine along a specific path or from a defined point to another point. However, the control procedure of these robots is more challenging than that of serial robots since their dynamics are extremely complicated and non-linear. In addition, saving energy, together with achieving the desired accuracy, is one of the most desirable objectives. In this paper, a proper non-linear optimal control is employed to gain the maximum accuracy by applying the minimum force distribution to the jacks. Dynamics of the jacks are included in this paper to achieve more accurate results. Optimal control is performed for a six-DOF hexapod robot and its accuracy is increased using a sequential feedback linearization method, while its energy optimization is realized using the LQR method for the linearized system. The efficiency of the proposed optimal control is verified by simulating a six-DOF hexapod robot in MATLAB, and its related results are gained and analysed. The actual position of the endeffector, its velocity, the initial and final forces of the jacks and the length and velocity of the jacks are obtained and then compared with open loop and non-optimized systems; analytical comparisons show the efficiency of the proposed methods.