Salvation is being saved from the righteous judgment of God upon the sinner.
A lot of people think that salvation means being saved from yourself or the devil. But that is not accurate. All who have sinned against God are under the judgment of God. This judgment is known as damnation where God condemns to eternal hell all those who have offended Him by breaking His Law.
This does not mean that God is unfair. It shows that God is holy. God must punish the sinner. But, He has provided a way of escape so that people will not face His righteous judgment. This means that God is both holy and loving. He must manifest each quality equally. So, being saved from the wrath of God is called salvation.
Salvation is found in Jesus, and only in Jesus, who is God in flesh (John 1:1,14), and who died for our sins and rose from the dead. 1 Cor. 15:1-4 says...
"Now I make known to you, brethren, the gospel which I preached to you, which also you received, in which also you stand, 2 by which also you are saved, if you hold fast the word which I preached to you, unless you believed in vain. 3 For I delivered to you as of first importance what I also received, that Christ died for our sins according to the Scriptures, 4 and that He was buried, and that He was raised on the third day according to the Scriptures,"
This is how salvation works: All of us have sinned against God and deserve judgment. But Jesus never sinned (1 Pet. 2:22). He lived the Law of God perfectly. In this He has a perfectly righteous standing before God. When the corrupt Jewish leaders forced Rome's hand into crucifying Jesus, God used this crucifixion as the means to place the sins of the world upon Jesus (1 Pet. 2:24; 1 John 2:2). This is when Jesus became sin on our behalf. 2 Cor. 5:21 says,
"He made Him who knew no sin to be sin on our behalf, that we might become the righteousness of God in Him."
The crucifixion became the place where Jesus bore our sins in His body and suffered in our place. "But He was pierced through for our transgressions, He was crushed for our iniquities; The chastening for our well-being fell upon Him, and by His scourging we are healed," (Isaiah 53:5). Remember, no sinner could please God perfectly and no sinner could offer a perfect sacrifice to God. Only God in flesh, Jesus, could do that.
So, since there is nothing we can do that is righteous before God (Isaiah 64:6 says our righteous deeds are filthy rags), then we cannot please an infinitely holy and righteous God by anything we do. But, Jesus who is perfectly righteous before God the Father, died in our place. What we could not do, He did.
If you want to escape the righteous judgment of God, then you need to trust in the sacrifice of God. You need to be made right before God, by God. This righteousness of Christ is given to you if you accept him, trust in Him, and believe in what Jesus did. This is why the Bible says that we are saved by grace through faith. "For by grace you have been saved through faith; and that not of yourselves, it is the gift of God," (Eph. 2:8).
When you trust in what Christ has done on the cross, and in no works of your own (since they aren't good enough anyway), then the righteousness of Christ is given to you -- even as your sins were "given" to Jesus. Its like a trade. He gets your sin. You get His righteousness.
Once you have trusted in what Christ has done, then you possess eternal life and you will never face the judgment of God.
“My sheep hear My voice, and I know them, and they follow Me; 28 and I give eternal life to them, and they shall never perish; and no one shall snatch them out of My hand," (John 10:27-28).