We have never spanked almost 4 year old DS until yesterday. Here's what happened:
We arrived home from the park and had 30 minutes to go inside, eat lunch, and leave again once DH got home to do something DS was really looking forward to. DS wanted to wait in the car. I calmly told him it wasn't an option because he's not allowed to be out in the driveway/front of the house by himself (busy street, garage was too full to pull in) and besides it was too hot to stay safely in the car.
DS refused and started banging things around in the car very roughly, almost breaking things. I calmly told him he needed to stop and he could walk in the house himself or I could carry him in, which would mean a time out in his room. He immediately slammed the console shut again so I grabbed him firmly and brought him into the house. On the way to his room he started hitting me. I told him this was not ok and I would take a toy away for every time he hit me. I was up to 5 by the time he got to his room. I stayed calm this whole time (amazingly).
After a couple minutes his room was quiet and I opened the door to talk it over. He had one leg out of his window sill and laughed at me as he climbed the rest of the way outside and ran around the house (first floor window). When he ran back inside I took hold of his arm and marched him back to his room to talk. He started hitting me again.
Now I was trapped: I couldn't stay and let him hit me and I had no safe place to leave him alone. Taking his toys/privileges away was having no affect on his behavior. I explained that because I wouldn't let him hit me and I couldn't safely leave him alone if he didn't stop I would have to spank him (I explained what this meant). He kept hitting me so I spanked him. He cried long and hard as I held him and explained calmly over and over why I did that. I just keep trying to figure out what else I could have done.
We bought a window lock so he won't be able to get out his window again, but what do I do if he's hitting me and there's not a safe place to leave him alone?