The optimal tracking controller for discrete-time systems with time-delayed in state and input under disturbance is considered. By introducing a variable transformation, the system with disturbance and time-delayed in state and input is transformed into a non-delayed system with disturbance, and the quadratic performance index of the optimal tracking control is transformed into a relevant format. The optimal tracking control law is obtained using maximum principle. By introducing a reduced-order observer to reconstruct the state of the exosystem, the problem of physically realizable of the optimal output tracking control law can be solved. Simulation results demonstrate the effectiveness of the optimal tracking control law.