Good question! Jesus himself said that he wasn't speaking of his own accord but that the Father spoke through him and how to react: "For I did not speak of my own accord, but the Father who sent me commanded me what to say and how to say it." John 12:49
The next verse we see the prophet Moses speaks of one that will be greater than himself and this greater one will have God 'put words in his mouth'. " I will raise up for them a prophet like you from among their brothers; I will put my words in his mouth, and he will tell them everything I command him. If anyone does not listen to my words that the prophet speaks in my name, I myself will call him to account."
Simply put, God was speaking through Jesus.