The word used here is "works" not fruit of the Spirit. James is saying that if we have faith, what we DO will point to the fact. Without these works, our faith is in fact dead. He is saying that a person who believes something, will act like a person that believes something.
That "act" is the works of faith. It is logical, because if you tell me you believe that the fire will not hurt you, then show me by walking through it. (That is the work of faith! ) Faith without that , is dead faith (only words) James is saying, if you say you have faith.......show it by HOW you act. IN other words, if you say the fire will not hurt you and you do not want to actually walk through it, then you only have words and no faith. The person who says something is so......must walk it. If not: That faith is dead.
am 2:17 Even so faith, if it have not works, is dead in itself.
So James want us to SHOW our faith , through our actions Jam 2:18 Yea, a man will say, Thou hast faith, and I have works: show me thy faith apart from [thy] works, and I by my works will show thee [my] faith. (meaning: I will walk through the fire (works) and then you try to convince me about your faith, if you do not want to walk through it )