We obey the gospel by having a change of mind from non-belief to believe; and if we trusted in works (self-righteousness), we change mind (repent) from trusting in our good works to trusting the Savior.
There is more than one kind of works, my friend.
One is of the flesh to attain righteousness, like that of Job, which is why I say he was not righteous.
While the other is of the spirit to justification, like Abraham did. Abraham was justified because of his faith. Job was not, because he based his righteousness on his own good works.
To deny works, is to deny the epistle of James.
Jas 2:17 Even so
faith, if it hath not works, is dead, being alone.
Jas 2:18 Yea, a man may say, Thou hast faith, and I have works: shew me thy faith without thy works, and I will shew thee my faith by my works.
Jas 2:19 Thou believest that there is one God; thou doest well: the devils also believe, and tremble.
Jas 2:20 But wilt thou know, O vain man, that
faith without works is dead?
Jas 2:21 Was not
Abraham our father justified by works, when he had offered Isaac his son upon the altar?
Jas 2:22 Seest thou how faith wrought with his works, and by works was faith made perfect?
Jas 2:23 And the scripture was fulfilled which saith, Abraham believed God, and it was imputed unto him for righteousness: and he was called the Friend of God.
Jas 2:24
Ye see then how that by works a man is justified, and not by faith only.
Jas 2:25 Likewise also was not Rahab the harlot justified by works, when she had received the messengers, and had sent them out another way?
Jas 2:26
For as the body without the spirit is dead, so faith without works is dead also.