1. Tell the Truth.
Assuming your spouse found out, you didn't confess—this is the time to tell the whole truth. It's probably best done with a therapist present, to keep a lid on the emotional reactions.
2. Give your Spouse the Power.
When you cheated, you took your partner's power away, so now let your spouse be in charge. Your spouse had no say about the cheating, so giving up control will help re-balance the power. Confess, apologize, and then ask what you need to do to be forgiven. Humility is the order of the day.
3. Get some Therapy.
Both of you need to recover from anger, resentment, grief, guilt and shock; this takes some time. You may each need individual therapy as well as couple therapy to repair the damage. Do whatever it takes, if you really want to stay in the marriage.
4. Focus on the Marriage.
Cheating implies a personal problem with both integrity and impulse control, as well as a relationship problem that created an excuse for the cheating. Focus not only on confession and forgiveness, but on repairing whatever was wrong in the marriage to start with.