We obey the moral law, first of all, by understanding what it’s for, and there are various ways of putting this.
For all my life I have been interested in the game of golf. Golf is played according to rules. I have never met a golfer who has said to me, “Let me move my golf ball nearer the hole,” and I said, “That’s fine,” because the game ceases to work when you don’t play it according to the rules.
Take the Ten Commandments, for example: the moral law. The moral law given in Exodus 20 is a written form of the basic way in which Adam and Eve functioned as human beings. And of course, it’s written now for sinners, and so it has a lot of negatives. But what the law is is a description of the master plan for your life. You only function as the image of God as you give expression to these principles in your life.
As we do that, trusting in the Lord, there is no real danger that we will become legalistic. I think it’s true that many people say, “Any obedience to the law is legalistic,” because actually what they are irritated by is the notion that anybody would tell them what to do. But if you are Christian, Jesus tells you what to do. He says, “If you love me, keep my commandments” (John 14:15).
So faith in Christ produces love for Christ. Love for Christ produces a desire to be like Christ. Christ fulfilled the law, and so being like Christ fulfills the law.
There are two other elements. One is that keeping the law is how we please our heavenly Father. The other is that both the Old Testament prophecy of the new covenant (Jer. 31:33) and the letter to the Hebrews, twice citing the words, say that when you are born again what is written into your heart is the law (Heb. 8:10; 10:16).
So in a way it’s kind of surprising that so many Christians who believe in the Holy Spirit are apparently not well enough instructed to know what it is that the Holy Spirit comes to do, which is to work into our hearts an affection for obedience to the law of God because of our love for and trust in the Lord Jesus Christ.
So long as we keep our loving heavenly Father in view, as long as we keep our Savior in view, and as long as we keep the Holy Spirit in view, we will be saved from any danger of falling into legalism no matter how much we may be accused of doing that, because we think it’s important to be obedient to the law.
Usually that kind of accusation comes from people who are irritated about the notion that anybody would tell you what to do, and there’s a bundle of commands in the New Testament.
I think the answer is fairly straightforward. The challenge is growing in grace so that that becomes a reality in our lives.