What good is it, my brothers and sisters, if someone claims to have faith but has no deeds? Can such faith save them? Faith by itself, if it is not accompanied by action, is dead. James 2:14, 17 NIV
The context of this passage is essential to understand. When we pick apart the words in this passage, we see a bigger picture of what the New Testament teaches about salvation. We begin to see that good works are not the means to the end of our salvation but rather the result of salvation.
It is clearly seen that we are not saved through our own works, no matter how great they may seem. Having the Spirit of God dwelling within us results from our willingness to come to Jesus Christ for salvation. Having a Spirit-filled mindset will ultimately result in good works. We must remember that our good works here on earth cannot save us for eternity and will not earn any higher favor with God. They can, however, demonstrate our faith to others and make it more real.