<abstract><p>In this study, we intend to present a numerical method with highly accurate to solve the time-delay optimal control problems with delay on both the state and control variables. These problems can be seen in many sciences such as medicine, biology, chemistry, engineering, etc. Most of the methods used to work out time delay optimal control problems have high complexity and cost of computing. We extend a direct Legendre-Gauss-Lobatto spectral collocation method for numerically solving the issues mentioned above, which have some difficulties with other methods. The simple structure, convergence, and high accuracy of our approach are the advantages that distinguish it from different processes. At first, by replacing the delay functions of state and control variables in the dynamical method, we propose an equivalent system. Then discretizing the problem at the collocation points, we achieve a nonlinear programming problem. We can solve this discrete problem to obtain the approximate solutions for the main problem. Moreover, we prove the gained approximate solutions convergent to the exact optimal solutions when the number of collocation points increases. Finally, we show the capability and the superiority of the presented method by solving some numeral examples and comparing the results with those of others.</p></abstract>