What good is it, my brothers, if someone says he has faith but does not have works? Can that faith save him?—James 2:14 ESV
When Paul teaches in Romans 4:5 that we are justified by faith alone, he means that the only thing that unites us to Christ for righteousness is dependence on Christ. When James says in James 2:24 that we are not justified by faith alone he means that the faith which justifies does not remain alone. These two positions are not contradictory. Faith alone unites us to Christ for righteousness, and the faith that unites us to Christ for righteousness does not remain alone. It bears the fruit of love. It must do so or it is dead, demon, useless faith and does not justify.
The glory of Christ in the gospel is not merely that we are justified when we depend entirely on Christ, but also that depending entirely on Christ is the power that makes us new, loving people. Depending entirely on Christ is how we are justified and how we are sanctified. Paul struck the one note. James struck the other. Both are true and together they bring Christ the glory due his name.