OCD is usually treated using a combination of Cognitive Behavioural Therapy and medication.
Cognitive Behavioural Therapy (CBT)
When undergoing Behavioral Therapy, a patient would be exposed to what triggers their compulsions. For example, if the fear of dirt compels the patient to wash their hands excessively, the therapists would expose the patient to dirt. After a while, when the patient sees that nothing has happened to them, their anxiety would slowly go away.
Cognitive therapy is somewhat similar. However, it mostly centers on exposure of the sufferer to what they fear most, and then showing her that there is nothing wrong with not doing an action. This helps a patient get use to the feelings of anxiety gradually.
Medication
Any medication given to the patient would usually come from the Specific Serotonin Reuptake Inhibtor (SSRI) group of drugs. This group of drugs is often given to supplement behavioral and cognitive therapy. It serves to generate serotonin (OCD may be caused by a shortage of serotonin in the brain) and try to prevent the unexplainable anxiety.