The talk back beast rears its ugly head every once and again in our home, and right now our 11 year old is struggling with this. Be prepared for it to come back later even if you deal with this now...but don't be afraid to work on this. One of the tools www.nogreaterjoy employs for something like this is a video camera. Catch them on tape being ugly and let them know what it looks like...chances are when they see the camera they're behavior will change...no one wants to see just how ugly they are being...or maybe a mirror.
I've started assessing fines and yes there is always the magic wand applied at the first sign of complaint over what is being asked...don't wait for things to escalate into an angry battle... Definitely punish the behavior she's already exhibited.
At school (or home too) you can use a penny jar (full) Whenever, the whining and complaining begins take a penny out everytime (have teacher do this too) at the end of the week (or time agreed) give child rest of the pennies (you can use 100 so that its easy to pay in the end)
Remember this is an area of training, our first step is to get their attention and then fill them with how they are supposed to act when parents and teachers ask something of us.
Watch Shirley Temple movies like the one with with the airplane scene where she sings "On the Good Ship Lolly Pop" and the other little girl is a real brat and breaks her doll.
There are some great verses in Proverbs like: "He who loves a pure heart and whose speech is gracious will have the king for his friend." Proverbs 22:11
Dress her up like princess and have dad be her King for the day, teach her how to respond to requests and instruction in a gracious manner as a princess. Make it imaginative and fun. Remember: "The tongue of the righteous is choice silver, but the heart of the wicked is of little value." Proverbs 10:20
At the end of your day you could give your little girl a charm bracelet with a little silver heart to remind her of the that her words should be "choice silver" and remind her that you expect her not to mouth off to you or her teachers
Your girl's 5, help her see what goodness looks like rather than just consequences and expectations.
We talk with our 11 year old on the decision she can make to add sunshine to our home, and work with her on her sour attitude towards school (also at home) This year I'm adding an hour of art to her schedule in the morning before she does anything, in an attempt to fill her cup so she will desire to serve instead of feeling like she's alway's being put upon to do what we want her to do. We want her to obey out of a spirit of love and respect, how we get there is a journey of the heart.