When it comes to salvation there are only two possible ways of obtaining it: You can merit it, or you can inherit it.
To merit salvation, you will need to live a completely sinless life. There is absolutely NO margin for error. You will need to make sure you NEVER disobey God in any way. You CANNOT ever do less than your duty. You CANNOT ever go beyond any parameter of God’s will. Your actions, speech, and thoughts MUST be impeccably pristine every second of every minute of every hour of every day of every week of every month of every year of every decade of your life. There is no “extra credit”; there are no “do overs”. If, and only if, you have lived this way, will you merit salvation when your last breath has been taken.
To inherit salvation, you will need to first become a legal son of God. You will need to obediently fulfill every requirement God gives for being born again. Once you have completed the adoption process as specified in God’s word, you will need to live obediently to your Father, just like His only begotten Son did. Though you will not live sinlessly like your older brother did, you will need to ever strive to walk in the light on the narrow way that leads to life. If, and only if, you have lived this way, will you inherit salvation when your last breath has been taken.
Because there is none righteous, no not one (Romans 3:10), the possibility of meriting salvation is universally eliminated.
The only remaining option is to inherit salvation, and that is exactly God’s eternally purposed plan which is graciously offered to us in the gospel.
Salvation is the gift of God (Ephesians 2:8). It is not merited. It is inherited by God’s obedient sons.