It can seem confusing that God could be completely loving and jealous at the same time. In the context of Exodus 20:4-6, God is not using the word “jealous” as you or I would. We use the word “jealous” to describe the feeling we get when someone else has something that we want or has qualities that we wish we had.
“Thou shalt not make up for yourself an idol in the form of anything in heaven above or on the earth beneath or in the waters below. You shalt not bow down to them or worship them; for I, the Lord your God, am a jealous God,” He is saying that He will not tolerate one of His creation worshipping or bowing down to a God other than Himself.
The word “jealous” fits perfectly because if you read on, it is clear that there is no gray area with the Lord, “punishing the children for the sin of the fathers to the third and fourth generation of those who hate me, but showing love to a thousand generations of those who love me and keep my commandments.” He will bless those who love Him and punish those who don’t. But He is jealous for, or longs for, the affections of all people. And notice that He is far more lavish with His rewards than He is long- lasting with His punishments.
In particular, the references made to God as a jealous God draw upon human emotions used as a metaphor to express something about God assuming human emotions, which is almost always negative and misunderstood to be a description about how God “really is.” To take this instead as an anthropomorphic description about God allows us to move beyond, negative human emotion. The Israelites existed in a world and among people who believed in the worship of many gods. Their greatest religious threat came from Canaanite fertility religions that personified the forces of nature into deities (Baal worship in the Old Testament).
The Canaanites would add Yahweh (a Hebrew name for God) that the Israelites worshiped, but only as another one of the many nature gods. The God of the Israelites was not just another god; He was (is) THE only true God. The Israelites recognized Him as the only Sovereign Creator God. The metaphor used to make this claim was the metaphor of God as a jealous God. He would not simply be added to the other nature deities, because He had created the aspects of nature that the Canaanites worshipped!
Hosea takes this metaphor and makes it positive, as He compares God’s relationship with Israel in the imagery of a marriage. The basis is love. “Jealousy” is a way to describe the love that a husband has for a wife who is unfaithful. This jealousy is one that hurts because of the unfaithfulness of the wife (Israel) in a relationship in which she had pledged herself to her husband who had loved and cared for her (God). So when biblical writers apply this term to God, they are affirming that He, as Creator and Deliverer, is the only God worthy of our worship.