Martin Luther called the book of James “a right strawy epistle.” He didn’t like it. To him, passages like James 2:14 conflicted with Paul’s gospel, who wrote, “For by works of the law no human being will be justified in his sight . . .” (Romans 3:20).
But they do come to agree, when we consider the order of salvation. No man can save himself; we are all dead in our trespasses and sins (Ephesians 2:1). Thus God must be the One to move to regenerate and save. We are so dead that faith itself must be given by God (Eph. 2:8).
And yet in the very next verse, Paul writes:
Ephesians 2:10 (ESV): For we are his workmanship, created in Christ Jesus for good works, which God prepared beforehand, that we should walk in them.
Saving faith is always by faith alone, in Christ Jesus alone. But along with saving faith God also gives works that follow from that saving faith. Thus while salvation is by faith alone, it never exists alone. Apple trees produce apples.
Thus “faith alone” - say, believing that there is one God - is insufficient: even the demons do that (2:19). Works must accompany faith, or it is no faith at all (2:24). Without works, one might conclude that the gift of faith was never given. Faith that is dead - without accompanying works (2:26) - might mean that the person is still dead in their sins (Eph. 2:1).