Can one earn salvation?

There is absolutely no way man can meritoriously achieve salvation. The scriptures are replete with teaching to this end. “Not by works of righteousness which we have done,” Paul writes, “but according to his mercy he saved us…”(Tit. 3:5). Salvation is a “gift of God” offered to man in his state of utter helplessness (Eph. 2: 1-8). Salvation is “not of yourselves…not of words, lest any man should boast” (2:9). Abraham and David exemplify the truth that one can not merit (“worketh”) salvation (Rom. 4:1-8).

While man can not earn salvation, works are required (Titus 3:5) not by works of righteousness which we have done, but according to His mercy He saved us, through the washing of regeneration and renewal of the Holy Spirit,
Tit 3:6 whom He poured out on us abundantly through Jesus Christ our Savior,
Tit 3:7 that being justified by His grace, we should become heirs according to the hope of eternal life.
Tit 3:8 Faithful is the Word, and as to these things, I desire that you strongly affirm that those believing God might be careful to maintain good works. These things are good and profitable to men.
Paul says “through faith” (Eph. 2:8). Grace is God’s part: faith is man’s part. Active, obedient faith is required (Gal. 5:6, Jas. 2:24).

Mat 5:16 Let your light so shine before men that they may see your good works and glorify your Father who is in Heaven.

One can not earn salvation through works, however works are produced by salvation.