Much of the confusion regarding this command revolves around the wrong translation of this hebrew word "ra.tsach" in some translations. It should properly be transliterated as murder not kill.
Murder means unlawful killing, this leaves open the ability for certain authorized bodies to lawfully kill under certain circumstances. If this was not the case we could not eat flesh as it involves the killing of an animal.
Another point to consider is that the law was given to humankind- the Israelite to be specific - At no point except where specifically stated did it mean that God himself was bound by it.
Since Jehovah is the highest authority and Judge in the universe his judicial decisions are always righteous.