An optical amplifier is disclosed having substantially uniform spectral gain. The amplifier comprises a variable optical attenuator coupled between first and second segments of active optical fiber. The attenuation of the optical attenuator is adjusted in accordance with the optical power input to the amplifier to thereby obtain substantially flattened gain. Alternatively, the attenuator can be controlled based on the respective gains associated with the first and second segments of optical fiber. For example, the attenuator can be adjusted so that so that the sum of the two gains remains substantially constant, a condition that also yields flat spectral gain. Further, optical powers associated with first and second wavelengths of amplified stimulated emission (ASE) light output from the amplifier can be used to adjust the attenuation of the optical attenuator. In an additional example, received optical powers associated with each of the channels in a WDM system are monitored and the attenuators within each amplifier in the system are controlled so that the received powers are substantially equal.