In regard to Romans 2:13, context is important. Paul was talking to the Jews (Romans 2:17-24) about their judging of the Gentiles and then points them to their own law (standard of judgment) and hypocrisy and tells them that the doers of the law will be justified before God (v. 13). That leaves them out, along with everyone else. (Romans 3:22-28; Galatians 2:16; Philippians 3:9) The standard they wanted to measure up to was the law. Paul was telling them that the doers of the law will be justified. So, obey the law, obey all of it, but if you don’t obey all of it, you failed!
Paul tells them that the Gentiles who didn't have the law according to the knowledge of the Jews were instinctively doing the things of the law (verse 14) and will be judged accordingly. How much more so the Jews? Paul was showing the self-righteous Jews who judged the Gentiles that they were not able to measure up to the perfect standard of the law. They were hypocrites. This is why Paul tells us in the very next chapter in Romans 3:28 that we are justified by faith apart from the works of the law. No one was able to perfectly obey the law (except for Jesus Christ). If you fail even once (stumble in one point), then you become guilty of all. (James 2:10)
In James 2:21, notice closely that James does not say that Abraham's work of offering up Isaac resulted in God accounting Abraham as righteous. The
accounting of Abraham's faith as righteousness was made in Genesis 15:6,
many years before his work of offering up Isaac recorded in Genesis 22. The work of Abraham did not have some kind of intrinsic merit to account him as righteous, but it
showed or manifested the genuineness of his faith. (James 2:18) That is the "sense" in which Abraham was "justified by works." He was
shown to be righteous.
The harmony of Romans 4:2-3 and James 2:21,24 is seen in the differing ways that Paul and James use the term "justified." Paul, when he uses the term, refers to the
legal (judicial) act of God by which He
accounts the believer as righteous. James, however, is using the term to
describe those who would show the genuineness of their faith by the works that they do.
In James 2:25, Rahab believed in the Lord with authentic faith (Joshua 2:9-13), requested "kindness" (2:12), received the promise of kindness (2:14), and hung out the "scarlet line" (2:21), as the
demonstration of her authentic faith. She
showed that her faith in God was not a dead faith by her works (James 2:18) just as all genuine believers show theirs.