My mother-in-law used to use "goody tickets" to redirect behavior. The idea is to give your daughter a "goody ticket" when you catch her in the act of behaving correctly. The payoff is that she needs to cash in those tickets for privileges like computer time, tv time, play dates, a special something you'd normally pick up while out shopping, stuff like that. Any thing fun must be "bought" with goody tickets. When your daughter can't "buy" her privileges, her behavior (hopefully) will change.
This worked very well on my otherwise well-behaved eldest son. For my younger son, we had to combine it with LOTS of time in a "bed and clothes" only room, since he was very stubborn about not following family rules.
Another idea you might try is, during a calm moment, you and your husband explaining that when you ask her to do something, the correct answer is always "yes, mom" or "yes, dad." That's it. End of story, period, amen. ANY other response is disobedience and will summarily punished. If your daughter has a concern, she may voice it AFTER she does whatever you ask. In this way, she acknowledges who is in charge (you and your husband) but she also gets a chance to express herself. If she has a good point, you can take it into consideration for the next time.
As for the misbehaving out in public, I discovered my sons, particularly my youngest, did this because they knew I would punish them less if we were out and about. Once I caught on to this, the best solution was to simply leave. If we were at a birthday party and my son(s) got sassy, we thanked the birthday child and parent and left. No fuss, no muss. Their "warning" was given in the car before we joined the party. If we were out shopping and they misbehaved, same thing. We simply left. Once we were home, they got a firm talking to (yelled at on a bad day) and time in their rooms. This was followed by age appropriate chores.
This technique was tough because I had LOTS of interrupted shopping trips and events (you can sit in a quiet room or the car, if it's truly NOT feasible to leave a party early). But, my kids did catch on and they improved.
As for spanking, I reserved that for when they did extreme things, like let go of my hand and run across the street or a busy parking lot. I think this happened once, so I guess the spanking was effective.
Last but not least, check out the book, "Parenting with Love and Logic." It'll give you great ideas that you can use with a smile and really ease the tension in these types of situations. I've used the "Teaching with Love and Logic" concept in my high school classroom for the last several years and it works like a charm.
Good luck.