A formulation for the commitment of electric power generators under a deregulated electricity market is proposed. The problem is expressed as a stochastic optimization problem in which the expected profits are maximized while meeting demand and standard operating constraints. First, we show that when an electric power producer has the option of trading electricity at market prices, an optimal unit commitment schedule can be obtained by considering each unit separately. Therefore, we describe solution procedures for the self-commitment of one generating unit only. This description is given for three certainty-equivalent formulations of the stochastic problem. The procedures involve application of optimization methods, statistical analysis, and asymptotic probability computations. The optimization problem uses Schweppe's definition of hourly spot price to drive self-commitment decisions. Under the assumption of perfect market competition, the volatility of hourly spot price of electricity is represented by a stochastic model, which highlights its dependence on demand, generating unit reliabilities, and temperature fluctuations. The exact computations become very time-consuming for large systems; we therefore use several approximation methods (normal, Edgeworth series expansion, and Monte Carlo simulation) for computing the required probability distributions. Dynamic programming is used to solve the stochastic optimization problem. Numerical examples show that for a market consisting of 150 generating units, the self-commitment problem can be accurately solved in a reasonable time.