A wagging tail is a form of dog communication. Dogs wag their tails to tell us something about how they're feeling.
What It Is
There are probably few people who haven't seen a dog wagging his tail, and most of the time it's obvious what the dog is trying to tell you with this kind of body language. It is important, however, that you pay attention to how the dog is holding his tail when he's wagging it. Is it relaxed and moving back in forth? Is his body moving along with the wagging? Or is the tail high and moving in a quick back and forth motion while the dog's body remains fairly erect and rigid? Where the tail is and the way a dog holds his body while he's wagging it can give you a clue about what he is trying to communicate.
What It Means
Most people look at a dog with a wagging tail and assume he is happy. Most of the time this is true, but there are times when a dog wags his tail right before he becomes aggressive. If a dog is wagging his tail and the rest of his body seems relaxed or is moving along with the wagging, you are dealing with a happy, comfortable dog.
If a dog is holding his body erect and rigid while wagging his tail, however, he may be telling you that he's feeling territorial or uncomfortable with something that is going on around him. In this case, the dog's tail will be held high and moving back and forth rapidly. This discomfort can be a precursor to aggression. This is one reason people sometimes report that a dog was wagging his tail right before he bit someone. So if you encounter a dog you don't know who is wagging his tail, check out what the rest of his body language is telling you before you approach.