Well, I agree that hitting/spanking is wrong, but...
We do have tempers, and sometimes they snap, AND, we learn, just like you have. I'm thinking you probably won't do that ever again.
If it had been me...
I'd picked the little guy up by the Nape of his Neck, carried him that way till he got over his attitude. Just like his Mother would have. And, I bet he would have been licking your hand (apologizing) in under TWO minutes.