Well, this sentence has five words as well...
Damn, that's harder than it looks!
A better translation into English would be" this sentence CONTAINS five words."
It seems that compter has MANY uses: to count, count (out/in), include, charge for, pay, take into account, take account of, have, expect, intend, allow, add up, to count (matter). So, yes, it seems like compte will work just fine. http://www.larousse.com/en/dictionaries/french-english/compter/17687
Yes, a phrase is inanimate, therefore cannot be said to possess anything. I believe the same is true of French; like you said, contenir would be a more natural verb to use.
Why use "posseder" instead of "avoir" if the "correct" translation is "This sentence has 5 words" and I am wrong for saying "this sentence posseses 5 words"? It seems that if "has" is the correct response then we would use "avoir".
I know. It is not the English I am questioning, rather it is a) why use "poseder" in French and b) why Duolingo marks "possesses 5 words" wrong.
"This sentence possesses five words" also has five words one of which is "possesses" which, is every bit as odd and no less correct in reflecting the turn of phrase in the original.