You cannot earn salvation by doing works.
Rom 11:6 And if by grace, then is it no more of works: otherwise grace is no more grace. But if it be of works, then is it no more grace: otherwise work is no more work.
Eph 2:8-10 For by grace are ye saved through faith; and that not of yourselves: it is the gift of God: (9) Not of works, lest any man should boast. (10) For we are his workmanship, created in Christ Jesus unto good works, which God hath before ordained that we should walk in them.