If salvation is by faith, what do we make of Matthew 12:50: "For whoever does the will of My Father who is in heaven, he is My brother and sister and mother"? And 1 John 2:4: "The one who says, 'I have come to know Him,' and does not keep His commandments, is a liar, and the truth is not in him; but whoever keeps His word, in him the love of God has truly been perfected"? And James 2:19: "You believe that God is one. You do well; the demons also believe, and shudder. But are you willing to recognize, you foolish fellow, that faith without works is useless?"
Does it mean that salvation is by faith and works? No, it simply means that faith which doesn't produce good works is not real faith. Good works is evidence of faith, and we will ultimately be judged by our works (1 Peter 1:17). Galatians 5:6 says: "The only thing that counts is faith expressing itself through love." And John 14:15 says: "If you love Me, you will keep My commandments."
Faith is like a prism that separates white light into a spectrum of colors. Just like the colors of a rainbow are evidence of light shining through a prism, good works are evidence of the Holy Spirit working through faith.
That means that trying to earn our salvation by good works is like drawing a rainbow with crayons. That's not what God is looking for because it is not evidence of his Light in our lives. And it leaves us feeling either self-righteous or discouraged because it has no power to change our hearts.
The absence of good works likewise means that our lives are devoid of his Light. Faith without works is dead (James 2:26). And dead faith is no faith at all.
God invites us to come to him and receive what he has to give. He wants to give us his love, so that doing his will comes naturally. He wants to give us his peace, so we are no longer at war with ourselves. And he wants to give us his joy, to empower us to live fully.
And he will give us the prism of faith if we ask him for it.