You've misunderstood the function of works. It's not for salvation.
3 For what saith the scripture? Abraham believed God, and it was counted unto him for righteousness. 4 Now to him that worketh is the reward not reckoned of grace, but of debt. 5 But to him that worketh not, but believeth on him that justifieth the ungodly, his faith is counted for righteousness. 6 Even as David also describeth the blessedness of the man, unto whom God imputeth righteousness without works (Romans 4:4-6)
"...to him that worketh NOT, but believeth on him that justifieth the ungodly, his FAITH is counted for righteousness."
Salvation is "without works" because the reward is NOT of debt, but of grace. Salvation is a "gift" not of works, lest any man should boast.
For by grace are ye saved through faith; and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. For we are his workmanship, created in Christ Jesus unto good works, which God hath before ordained that we should walk in them.(Ephesians 2:8-10)
Not that we MUST walk in them, but SHOULD. "By grace though faith" gets one to heaven. "Works" determine the rewards one receives in heaven.
For other foundation can no man lay than that is laid, which is Jesus Christ. Now if any man build upon this foundation gold, silver, precious stones, wood, hay, stubble; Every man's work shall be made manifest: for the day shall declare it, because it shall be revealed by fire; and the fire shall try every man's work of what sort it is. If any man's work abide which he hath built thereupon, he shall receive a reward. If any man's work shall be burned, he shall suffer loss: but he himself shall be saved; yet so as by fire. (1 Corinthians 3:11-15)
Even without rewards (debt reckoned from works) "he himself shall be saved".