I think the first thing you need to do is take a deep breath and
accept that this happened and
you need help and
then ask for it. As to telling your spouse, its going to be a time thin - until you understand yourself this is something which you need to place to the side a bit - telling your spouse now at this stage would I suspect damage or destroy a relationship when you are at a fragile place.
Definetly a therapist here, if you do not have one get one, they are invaluable resources.