But that is not how the word 'works' is used here in James 2:14
Strong’s Definitions [?](Strong’s Definitions Legend)
ἔργον érgon, er'-gon; from a primary (but obsolete) ἔργω érgō (to work); toil (as an effort or occupation); by implication, an act:—deed, doing, labour, work.
Works, as used here, implies some physical act or labor as opposed to a more spiritual perspective such as obedience, trust, love, etc which is something due God simply because He is God as is stated:
om 14:10 Why do you pass judgment on your brother? Or you, why do you despise your brother? For we will all stand before the judgment seat of God;
Rom 14:11 for it is written, “As I live, says the Lord, every knee shall bow to me, and every tongue shall confess to God.”
Rom 14:12 So then each of us will give an account of himself to God.
In James 2:21 the work is obedience to do what God commanded him to do.
Work = The effort obedience requires.
Without this work of obedience faith is s dead, inactive and unable to produce the divine result intended by God, just as a body is dead without the spirit.
For as the body without the spirit is dead, so faith without works is dead also. James 2:26
JLB