James is using this rhetorical question to instruct his audience. Alternate translation: "it was what Rahab the prostitute did that justified her ... another road." (See: [[rc://en/ta/man/jit/figs-rquestion]] and [[rc://en/ta/man/jit/figs-activepassive]])
This can be restated to remove the abstract noun "works." This can also be stated in active form. Alternate translation: "did God not justify Rahab the prostitute because of what she did ... another road?" or "God justified Rahab the prostitute because of what she did ... another road." (See: [[rc://en/ta/man/jit/figs-abstractnouns]] and [[rc://en/ta/man/jit/figs-activepassive]])