The true saving faith in Christ will be shown unavoidably in the character and in the believer's conduct, producing deeds of obedience and of love - that is, of obedience to God and of love for the neighbour. Without those deeds, the professed "faith" will only be of mouth or of the mind.
Here is a type of faith that is only theoretical or intellectual, but without real contact with God. The person believes that the Bible is right, that the Gospel regarding Jesus and salvation (or perdition) is the truth, he can call himself a “believer" and be member of a church - however no evidence is seen in his conduct of the lordship and the love of Christ. Such a person "believes" everything, as a doctrine, but he doesn't allow his "faith" to guide his life; he was not "born again" - his faith is as useless as the "charity" that commiserates in words with the person in need, but although being able to, does nothing to relieve him.
Faith that is only intellectual, accepting the existence of God and the truth of Scripture, is no better than the demons' faith; they know that God exists and that His Word is the truth - but they are not for that reason saved and they tremble in contemplation of their horrible destiny.
"Pagans" have many "gods", which they serve in fear. The Scripture says that these "gods" are really demons (1 Corinthians 10.19-20); however, there are "Christians" that say, indignantly that they "are not pagans", but their faith does not go beyond that of the demons: they believe in God, but they don't love Him, nor do they obey Him.
Faith which is not shown through a converted life, by means of a love that obeys the will of Christ – such a faith is inoperative for salvation, because its possessor never received Jesus Christ as LORD of his life (Romans 10.9). Christ doesn't live in him (Galatians 2.20).
In this passage, James shows two examples, taken from the Old Testament, of people whose faith in God was clearly demonstrated by the deeds they did as believers - not for them to be saved, but as a result of their already being saved. Both Abraham and Rahab were believers in God before they did the deeds mentioned here by James - see Genesis 15.16; Joshua 2.9-11. This saving faith of theirs, already known by God, was revealed to men by the deeds that it produced in them in certain circumstances - by Abraham's readiness in preparing to offer his son Isaac in holocaust to God and for the help that Rahab gave to the Israelite spies, so risking her own life.
These "deeds" didn't save Rahab nor Abraham, because "by deeds nobody is saved" (Romans 3.20) - but they were the proof or the fruit of the faith through which they had already been saved; they were the "good deeds" that we find in the exhortation of Mathew 5.16 – “Let your light so shine before men, that they may see your good works and glorify your Father in heaven" and in 1Peter 2:12 – “having your conduct honourable among the Gentiles, that when they speak against you as evildoers, they may, by your good works which they observe, glorify God in the day of visitation"
In this way, Peter, James, Paul and John agree on this matter:
"We are His workmanship, created in Christ Jesus for good works, which God prepared beforehand that we should walk in them " (Ephesians 2.10).
"We love Him because He first loved us" (1a. John 4.19).
“The good works which they observe " (1a. Pedro 2.12).
"As the body without the spirit is dead, so faith without works is dead also " (James 2.26).
May our faith be alive and effective, producing the fruits which will be for the glory of God.