Equilibria in noncooperative games are typically inefficient, as illustrated by the Prisoner's Dilemma. In this paper, we quantify this inefficiency by comparing the payoffs of equilibria to the payoffs of a ``best possible'' outcome. We study a nonatomic version of the congestion games defined by Rosenthal, and identify games in which equilibria are {\em approximately optimal} in the sense that no other outcome achieves a significantly larger total payoff to the players---games in which optimization by individuals approximately optimizes the social good, in spite of the lack of coordination between players. Our results extend previous work on traffic routing games.