That’s a very important question, and throughout history those who have called themselves Christians have answered it differently. Let me begin with a contrast. There is a group who would say that we will be saved in the end only by God’s grace, but God has chosen to extend that grace by a number of different means. In other words, if you want to receive God’s grace, which is able to make you right with God, you have to do certain things. You need to be baptized; you need to attend services where you can observe communion; you need to confess your sins and say certain prayers in order to be forgiven; and there’s more. They believe that it’s only through these avenues of grace that you can finally be made right with God.
What does the Bible say about this? The Bible does say that salvation is on the basis of grace but also that it’s only through faith in what Christ has done for us (Ephesians 2:8-9). We cannot save ourselves. There is nothing we can do in order to deserve salvation. Salvation is based on grace, meaning that it’s a kindness that we do not deserve. It’s freely given to us by God. He doesn’t owe it to us; he is free to give it or withhold it. And God has chosen to save us through faith rather than by works.
In Romans 3, Paul explains that we are all under the power and condemnation of sin (vs. 9). He goes on to say that one of the purposes of the Law (which includes God’s instruction on right and wrong) is to demonstrate that we are all guilty before God (vs. 19-20; see also 1:18, 20, 2:1-2). There is no way to be right with God by obeying his instructions because what his instructions reveal is that we are not obeying him and need his forgiveness and grace. But God has revealed a different way to be made right with him, and Paul says that it’s by faith (vs. 22). All have sinned and stand condemned before God, so everyone must be made right with God by faith (vv. 23-24). While dying on the cross, Jesus was put on display as the payment for the punishment sinners deserve. He paid the punishment for all who believe that he paid that punishment for them (vs. 25). In chapter 4, Paul explains that sinners are declared right with God not on the basis of what they do but on the basis of their faith in what Christ has done for them.
So how is one saved? They are saved from God’s punishment for sin and from sin’s power over them by putting their faith in Jesus’ death and resurrection. But we should be clear that true faith is never without genuine repentance. You cannot really believe Jesus died for your sins if you don’t think your sins are a big deal. True faith involves recognizing how sinful you are and how great your need is for forgiveness through Christ.
Coming back to the group I described at the beginning, salvation is not acquired by what we do, even if we say we're acting on the basis of God’s grace. We are saved by putting our trust in Christ to save us. When we set up rituals as a means of salvation, we are putting obstacles in the way of genuine faith because people place their faith in the ritual rather than in Christ. In other words, they are trusting in what they are doing rather than in what Christ has done. Salvation does not require a special ritual or a special place. Salvation is by grace through faith, and faith can be expressed wherever you are.