We present a general formalism based on the variational principle for finding the time-optimal quantum evolution of mixed states governed by a master equation, when the Hamiltonian and the Lindblad operators are subject to certain constraints. The problem reduces to solving first a fundamental equation (the {it quantum brachistochrone}) for the Hamiltonian, which can be written down once the constraints are specified, and then solving the constraints and the master equation for the Lindblad and the density operators. As an application of our formalism, we study a simple one-qubit model where the optimal Lindblad operators control decoherence and can be simulated by a tunable coupling with an ancillary qubit. It is found that the evolution through mixed states can be more efficient than the unitary evolution between given pure states. We also discuss the mixed state evolution as a finite time unitary evolution of the system plus an environment followed by a single measurement. For the simplest choice of the constraints, the optimal duration time for the evolution is an exponentially decreasing function of the environments degrees of freedom.