What good is it, my brothers, if someone says he has faith o but does not have works? Can that faith save him? If a brother or sister is poorly clothed and lacking in daily food, and one of you says to them, “Go in peace, be warmed and filled,” without giving them the things needed for the body, what good is that? So also faith by itself, if it does not have works, is dead.
But someone will say, “You have faith and I have works.” Show me your faith part from your works, and I will show you my faith by my works. You believe that God is one; you do well. Even the demons believe—and shudder! Do you want to be shown, you foolish person, that faith apart from works is useless? Was not Abraham our father justified by works when he offered up his son Isaac on the altar? You see that faith was active along with his works, and faith was completed by his works; and the Scripture was fulfilled that says, “Abraham believed God, and it was counted to him as righteousness”—and he was called a friend of God. You see that a person is justified by works and not by faith alone. And in the same way was not also Rahab the prostitute justified by works when she received the messengers and sent them out by another way? For as the body apart from the spirit is dead, so also faith apart from works is dead. - James 2:14-26 ESV
Notice verse 14:
What good is it, my brothers, if someone says he has faith but does not have works? Can that faith save him?
What faith? A faith that does not have works. It's a dead faith. If someone says he has faith but lacks the resulting evidential works, one must doubt that he has been saved.
As Martin Luther said, "It's not faith and works, but a faith THAT works."
This same thought is continued in verse 17:
So also faith by itself, if it does not have works, is dead.
Faith that is not follow by the accompanied action is useless and dead, unable to save.
Notice also verse 18:
But someone will say, “You have faith and I have works.” Show me your faith apart from your works, and I will show you my faith by my work.
The evidence for faith, is works. Faith can be shown only through righteous deeds.
Now look at verse 22:
You see that faith was active along with his works, and faith was completed by his works;
James does not disagree that faith alone saves. “Completed” (Gk. eteleiōthē) often means “bring to maturity.” Full-grown and genuine faith is seen in the good deeds it produces.
James apparently has a different sense of the word “justify” in view here, as evidenced by the different Scripture passages, and the different events in Abraham's life, to which James and Paul refer. The primary way in which Paul uses the word “justify” (Gk. dikaioō) emphasizes the sense of being declared righteous by God through faith, on the basis of Jesus' atoning sacrifice (as in Romans 3:24–26), whereas the primary way that James uses the word “justify” (Gk. dikaioō) in James 2:21 seems to emphasize the way in which works demonstrate that someone has been justified, as evidenced by the good works that the person does (compare with Matt. 12:33–37).
Notice now verse 24:
You see that a person is justified by works and not by faith alone.
James view and Paul's are compatible. For James, “faith alone” means a bogus kind of faith, mere intellectual agreement without a genuine personal trust in Christ that bears fruit in one's life. James, in agreement with Paul, argues that true faith is never alone, that it always produces works (compare with Ephesians 2:10)
Is faith a work? Paul and James are not implying that even genuine faith is the basis of salvation; rather, it is the means and instrument by which one is saved. We are saved by Grace through Faith. And all of this doesn't come from us, it's God's gift.
For by grace you have been saved a through faith. And this is not your own doing; it is the gift of God, not a result of works, so that no one may boast. - Ephesians 2:8-9
Works are the root and evidence of true justifying faith.
Grace and peace to you,