This is such an important question that it deserves a careful answer.
The Bible clearly teaches that the moment a person turns from his sin and trusts in Jesus to be forgiven of his sin, he is saved (Acts 2:37-41). He has passed from spiritual death to spiritual life (John 5:24) and been declared not guilty in God's court of law (Rom 3:21-26). From God's perspective his salvation is an objective reality that cannot be changed (Rom 8:28-30).
But from our subjective experience, we may not feel certain. The difficulties of life and discouragement over our sin can lead us to question the reality of our salvation. Or perhaps we read one of the “warning” passages about turning away from the faith or the unforgivable sin and wonder if we are truly saved.
The apostle John wrote his first letter to address this very question: “I write these things to you who believe in the name of the Son of God that you may know that you have eternal life” (1 John 5:13). So when we read through John’s letter, we see that he answers this question from several different angles.
The starting point is the person and work of Jesus Christ. He describes Christ as our advocate (1 John 2:1), meaning that he pleads our case before the Father when Satan accuses us. Through his sacrificial death on the cross for our sins Jesus has satisfied God’s righteous wrath against us (1 John 1:7; 2:2; 4:10). By confessing that we believe that Jesus is the Son of God who came in the flesh to save us from our sins we can be confident that we have eternal life (1 John 4:2, 13-15; 5:13). Therefore “Whoever has the Son has life; whoever does not have the Son of God does not have life” (1 John 5:12).
John does not stop there, however. He builds on the foundation of ongoing trust in the person and work of Christ by reminding us about the testimony of the Holy Spirit living inside of believers (1 John 3:24). The Spirit reminds us of the truth of who Jesus is and what he has done for us (1 John 4:2, 6). As we experience the Spirit at work in our lives we are reassured that God truly abides in us (1 John 4:13).
Of course, faith in Jesus Christ and our perception of the Holy Spirit living inside of us can still seem quite subjective. That is why John points to how a person lives as tangible evidence of truly being born again. Those who truly know Jesus Christ by faith will actively pursue obeying God’s commandments (1 John 2:3) just as Jesus himself did (1 John 2:6). The most fundamental commandment is to believe in Jesus (1John 3:22-24), but genuine faith works itself out in love in tangible acts of love towards others, especially fellow believers (1 John 3:11-18; 4:7-12, 20-21; 5:1-2). Those who are children of God show their true identity by pursuing a pattern of turning away from sin and towards a life of righteousness (1 John 3:4-10). And when we inevitably fall short of perfect obedience, we have the promise that God is faithful to forgive and cleanse us (1 John 1:9).
So our salvation depends solely on the person and work of Jesus Christ. As we continue to trust in him we will experience the power of the Holy Spirit at work in our lives to make us more like Jesus. When we see this happening our assurance that we truly are one of God’s children grows.