I am aware that there are many other threads trying to tackle the question of how to be saved. I acknowledge that this is a very important question, in fact in my opinion it may be the single most important question that man can ever ask. Before i go on any further i would like to say firsthand that my answer to this important question will be entirely biblically based. I expect that many people, especially those who do not believe the bible, those who do not believe in the christian god, and those who subscribe to a different religion/viewpoint will reject the information that i offer in this post. If you are among those i mentioned i humbly and sincerely request that you respect my post. I am not requiring or imposing that you agree with me. For those who do believe in the christian god and who sincerely desire to be saved, this post is for you and I hope that this will clarify and enlighten any confusion you may have.
A key point to consider is this: All men are sinners and the wages of sin is death (romans 6:23)
The bible basically tell us that there are two ways to attain salvation.
The first is thru the law (a works-based system) which can basically be summarised as:
Love the Lord your God with ALL your heart, ALL your soul and ALL your strength and love your neighbour as you love yourself. (notice the word ALL, not part, not some but ALL)
(mark 12:28-34)
Now since man is inherently and hopelessly sinful, he can never really fully follow the law. He is bound to break it and sin. Thus man can never be saved by the law for all men fall short of the law. This is not say that the law is useless, it was given as a guide for our behavior and as a standard for us to strive for.
It also follows that man can never be saved thru his good works because even when he is doing "good" he is not doing it all the time, he is doing it for wrong or misplaced motives, and he still continues to sin.
Also, in the bible it says that man's righteousness is but filthy rags to God (isaiah 64:6). No matter we do, no matter how good we think we are, it is never enough. We will always fall short of God who is perfect.
The second and really the ONLY way that man can attain salvation is by grace thru faith. All men are sinners and the wages of sin is death. All mankind therefore is bound to go to hell. But since God so loved the world, he gave his son as a perfect atoning sacrifice for all of man's sins (john 3:16). Thru God's sacrifice of his son (his grace) our sin though bright as scarlet is washed white as snow. When a person hears and believes the gospel (faith) he or she partakes of God's grace. That person begins to see himself for what he trully is, a wretched and unworthy sinner. He then realises just how lucky he is because despite his condition of unworthiness God has chosen to give him the gift of salvation. This causes him to love God, to desire him and follow him and to repent of his sins and turn from his wicked ways. Note that he does good works not so that he may be saved but AS a RESULT of having been saved, and he does these works because he loves God and desires to follow him.
Again to summarise salvation can only happen by grace thru faith, not by works, not by the law. Faith in what? Faith in jesus christ and the gospel (...whoever believes in him shall not perish but have eternal life).