  We present the first automated fitting method for the quantitative
spectroscopy of O- and early B-type stars with stellar winds. The method
combines the non-LTE stellar atmosphere code FASTWIND from Puls et al. (2005)
with the genetic algorithm based optimizing routine PIKAIA from Charbonneau
(1995), allowing for a homogeneous analysis of upcoming large samples of
early-type stars (e.g. Evans et al. 2005). In this first implementation we use
continuum normalized optical hydrogen and helium lines to determine
photospheric and wind parameters. We have assigned weights to these lines
accounting for line blends with species not taken into account, lacking
physics, and/or possible or potential problems in the model atmosphere code. We
find the method to be robust, fast, and accurate. Using our method we analysed
seven O-type stars in the young cluster Cyg OB2 and five other Galactic stars
with high rotational velocities and/or low mass loss rates (including 10lac,
zeta Oph, and tau Sco) that have been studied in detail with a previous version
of FASTWIND. The fits are found to have a quality that is comparable or even
better than produced by the classical ``by eye'' method. We define errorbars on
the model parameters based on the maximum variations of these parameters in the
models that cluster around the global optimum. Using this concept, for the
investigated dataset we are able to recover mass-loss rates down to ~6d-8
Msun/yr to within an error of a factor of two. Comparison of our derived
spectroscopic masses with those derived from stellar evolutionary models are in
very good agreement, i.e. based on the limited sample that we have studied we
do not find indications for a mass discrepancy.
