Spoilers serve two distinct purposes on cars.
One is to provide downforce for the driving wheels and to improve high-speed handling. These spoilers are generally shaped as reverse air-foils, made of carbon fibre, and have a significant surface area. Formula 1 (F1) cars have this type of spoiler, front, rear, and (in 2000) mid (x-wings).
Generally, these spoilers produce extreme amounts of downforce. As an example, a Williams FW17 F1 car generates more than 2000lbs of downforce at 260kph. This, being that the car weighs less than 1400lbs, would render it capable of driving on a ceiling. This is however, not the intended use.
Generally, it is assumed that in high speed cornering (above 180kph), the downforce is sufficient to allow F1 cars to corner at 2.5G, as opposed to approximately 1.5G for an unfaired/unspoilered vehicle.
The coefficient of drag of these cars is subsequently greatly increased. In fact, simply lifting off the gas in an F1 car at speed will produce braking force in excess of max braking of a street car, due solely to the downforce.
On a street car, spoilers are often added by the manufacturer to decrease the coefficient of drag. How is this possible?
The coefficient of drag of a car is based on the frontal area, but also on the shape of the car. A car with a higher tail has a lower Cd than a car with a low tail. For instance, a Ford Focus station wagon has a lower Cd than the Focus sedan. A small lip spoiler, that does not produce much downforce at all, but effectively raises the rear of the car, thus lowering the Cd. This will also have a positive effect on fuel economy.
Most street racers who have big wings on their cars are misguided. A properly engineered wing will produce positive downforce at freeway speeds, but most of the big wings you see on Civics are simply styled, not engineered for downforce, and have a negative effect on both handling and Cd.
An example of functional spoilers for fuel economy are the lip on the Honda Insight. An example of a functional spoiler for downforce on a production car is the spoiler on the 911 GT2.
Hope this helps.