A distributed algorithm is presented in this technical paper under directed communication networks, which is used to solve the economic dispatch problem in fixed time in smart grid systems. A new globally fixed-time stability theory (Lemma 3) is first given in this paper, which contains a new upper bound for the estimation of the settling time. Moreover, the fixed-time convergence for the proposed algorithm is rigorously proved with the aid of convex optimization theory, the new lemma and Lyapunov stability theory under the strongly connected and weight-balanced network topology. Finally, numerical simulations show the effectiveness and advantages of the distributed fixed-time optimization algorithm.