James 2:22 Do you see that faith was working together with his works, and by works faith was made perfect? 23 And the Scripture was fulfilled which says, "Abraham believed God, and it was accounted to him for righteousness." And he was called the friend of God.
In context James is teaching that faith without works (i.e. works of faith) cannot save us:
James 2:14 What does it profit, my brethren, if someone says he has faith but does not have works? Can faith save him? 15 If a brother or sister is naked and destitute of daily food, 16 and one of you says to them, "Depart in peace, be warmed and filled," but you do not give them the things which are needed for the body, what does it profit? 17 Thus also faith by itself, if it does not have works, is dead. 18 But someone will say, "You have faith, and I have works." Show me your faith without your works, and I will show you my faith by my works. 19 You believe that there is one God. You do well. Even the demons believe—and tremble! 20 But do you want to know, O foolish man, that faith without works is dead? 21 Was not Abraham our father justified by works when he offered Isaac his son on the altar? 22 Do you see that faith was working together with his works, and by works faith was made perfect? 23 And the Scripture was fulfilled which says, "Abraham believed God, and it was accounted to him for righteousness." And he was called the friend of God.
God had made promises to Abraham:
1. That he would be given the land of Canaan for an eternal possession.
Genesis 17:8 And I will give unto thee, and to thy seed after thee, the land wherein thou art a stranger, all the land of Canaan, for an everlasting possession; and I will be their God.
This of course meant that in process of time Abraham would be raised from the dead to eternal life on the earth.
2. That his descendants would become a great nation
Genesis 12:2 I will make you a great nation; I will bless you And make your name great; And you shall be a blessing.
3. That in his seed (descendent) all nations would be blessed.
Genesis 17:8 "Also I give to you and your descendants after you the land in which you are a stranger, all the land of Canaan, as an everlasting possession; and I will be their God."
That seed was Jesus Christ, and the blessing offered to all nations was forgiveness of sins made possible through his sacrifice.
4. That his seed would go through Isaac.
Genesis 21:12 But God said to Abraham, "Do not let it be displeasing in your sight because of the lad or because of your bondwoman. Whatever Sarah has said to you, listen to her voice; for in Isaac your seed shall be called.
God then tested his belief by telling him to go and offer Isaac (still too young to have children) as a burnt sacrifice.
Genesis 22:2 Then He said, "Take now your son, your only son Isaac, whom you love, and go to the land of Moriah, and offer him there as a burnt offering on one of the mountains of which I shall tell you."
Abraham was willing to sacrifice Isaac because God had promised that his seed would go through Isaac. He reasoned that if Isaac was sacrificed God would raise Isaac from the dead immediately in order for his promise to be fulfilled.
Hebrews 11:17 By faith Abraham, when he was tested, offered up Isaac, and he who had received the promises offered up his only begotten son, 18 of whom it was said, "In Isaac your seed shall be called," 19 concluding that God was able to raise him up, even from the dead, from which he also received him in a figurative sense.
His willingness to sacrifice Isaac – a work of faith – was counted to Abraham for righteousness.
Genesis 15:4 And behold, the word of the LORD came to him, saying, "This one shall not be your heir, but one who will come from your own body shall be your heir." 5 Then He brought him outside and said, "Look now toward heaven, and count the stars if you are able to number them." And He said to him, "So shall your descendants be." 6 And he believed in the LORD, and He accounted it to him for righteousness.
Genesis 22:16 and said: "By Myself I have sworn, says the LORD, because you have done this thing, and have not withheld your son, your only son — 17 "blessing I will bless you, and multiplying I will multiply your descendants as the stars of the heaven and as the sand which is on the seashore; and your descendants shall possess the gate of their enemies. 18 "In your seed all the nations of the earth shall be blessed, because you have obeyed My voice."
No one other than Jesus Christ could ‘earn’ righteousness.
Everyone else must have righteousness counted to them for their faith in the promises of God.
Jesus Christ’s sacrifice is efficacious for the faithful in the Old Testament as well as the New.
He is the promised seed of Abraham in whom all nations are blessed.
The blessing is received by faith.
Romans 3:30 since there is one God who will justify the circumcised by faith and the uncircumcised through faith.
Abraham saw his promised seed (Jesus) with the eye of faith and acted accordingly.
John 8:56 "Your father Abraham rejoiced to see My day, and he saw it and was glad."
James’ message is that our faith is demonstrated by what we say and do as a consequence of what we believe.
Matthew 5:16 "Let your light so shine before men, that they may see your good works and glorify your Father in heaven.
If we do nothing as a result of what we believe we are like the man in the parable who hid his talent in the ground.
We cannot earn salvation by the works of the Law, but we can throw salvation away by not working the works of faith.
I hope you find this helpful.
If you would like to respond to, or have a question arising from this answer, please go to please go to https://www.thisisyourbible.com/ and submit it. Thanks!