The tension between faith and works has been debated in the church for thousands of years. Martin Luther, for example, wanted to expel the book of James from the canon due to its emphasis on works. So it is critically important in the conversation between faith and works that we understand what John is actually saying in this passage. He is affirming that keeping the commandments is necessary as the appropriate response to God – yet not as a condition for salvation but as a sign of knowing God. The claim John is making is ultimately to abide in Christ. This concept is much more profound than simply imitating behaviors or even simple obedience to Christ’s commands. It has to do with living your whole life in God’s presence, as Jesus did. We see that Jesus was obedient to the will of the Father, but even more than that, he seems to have always lived in loving fellowship with the Father. Thus, for us, the call to obedience is centered around transformation, not simply behavior modification. To live our lives in fellowship with God and allow him to bring us to obedience in his timing and in his way.
"And by this we know that we have come to know him, if we keep his commandments. 4 Whoever says “I know him” but does not keep his commandments is a liar, and the truth is not in him, 5 but whoever keeps his word, in him truly the love of God is perfected. By this we may know that we are in him: 6 whoever says he abides in him ought to walk in the same way in which he walked."
1 John 2:3-6