First, remember that fire extinguishers are only effective on fire in its earliest stages. If the fire is well established or you're not confident in your ability to effectively handle it, walk to safety and then dial 9-1-1 to dispatch the fire department, or follow your established emergency protocol.
If you do catch the fire just as it's starting, remember to follow the following steps, using the acronym "P.A.S.S":
P: Pull the pin.
The pin in the handle of the fire extinguisher keeps it from discharging during normal handling. You must remove the pin to allow the extinguisher to function. There is usually a plastic tamper seal holding the pin in place. It should break easily when you pull the pin.
A: Aim at the base of the fire.
You must direct the fire extinguisher at the base or source of the fire. Spraying the flames will not work. Aim for the material that is burning.
S: Squeeze the handle.
Standing at least six feet from the flames, squeeze the handle of the extinguisher to discharge. If you are using a carbon dioxide extinguisher, avoid touching the horn-shaped nozzle; this can cause frostbite.
S: Sweep from side to side
As you squeeze the handle and extinguisher discharges, use a side-to-side sweeping motion to completely cover the burning material until the flames die out. Continue to monitor the area as hot spots can cause additional flare ups.