In this paper, an optimal direct adaptive fuzzy controller is designed for a class of uncertain nonlinear continuous systems through the following three steps: first, some fuzzy sets whose membership functions cover the state space are defined; then, firefly algorithm is used as a novel nature inspired optimization approach to construct an initial adaptive fuzzy controller in which some parameters are free to change. In other words, the control knowledge (fuzzy IF-THEN rules) is incorporated into the fuzzy controller through the setting of its initial parameters and simultaneously determining a suitable adaptation parameter by using the FA; finally, an adaptive law is developed to adjust the free parameters based on a Lyapunov synthesis method. It is confirmed that i) the closed-loop system using this optimal adaptive fuzzy controller is globally stable in the sense that all signals involved are bounded and ii) the tracking error converges to zero asymptotically. Finally, the proposed control scheme applies to the two well-known examples in the nonlinear control problems. Moreover, the two different methods that are non-optimal Direct Adaptive Fuzzy (DAF) control, and DAF based on particle swarm optimization method are also implemented for comparison. The results demonstrate the effectiveness of the proposed optimal direct adaptive fuzzy control methodology.