Jesus said that no man comes to the Father but by Him (John 14:6, 8:24), and that mankind needs a second birth in order to get to Heaven (John 3:3-7).
This article will explain why that is, by looking at verses which all deal with a single word - "righteousness".
According to the Word of God, no human being on earth performs well enough to be considered "righteous" by God:
Romans 3:10
10 As it is written, There is none righteous, no, not one:
According to the above, and bolstered by the testimony of other verses of Scripture (Ecclesiastes 7:20, Psalm 14:2-3, Romans 3:11-12, 3:23, Matthew 19:17, Mark 10:18, Luke 18:19), no one is righteous in the sight of God.
Despite the fact that no one is righteous, everyone will be judged against the very standard of righteous perfection according to the Law, Jesus Christ Himself:
Acts 17:31
31 Because he hath appointed a day, in the which he will judge the world in righteousness by that man whom he hath ordained; whereof he hath given assurance unto all men, in that he hath raised him from the dead.
No one will pass that judgement, because no flawed human being can measure up to Jesus, who never committed a single sin (Hebrews 4:15).
This is why Jesus said, when speaking in regard to the most stringent Law keepers on Earth, the Pharisees:
Matthew 5:20
20 For I say unto you, That except your righteousness shall exceed the righteousness of the scribes and Pharisees, ye shall in no case enter into the kingdom of heaven.
As far as keeping the Law went, these men were the best of the best. In fact, they were so known for piety that when the Apostle Paul offers evidence of his obedience to the Law, he simply mentions that he was a Pharisee (Philippians 3:4-6). A person has to be better than them to get to Heaven.
Yet, despite this high mark for entrance, none are righteous. As a result, none, in their natural state, will either enter or inherit the Kingdom of God:
1 Corinthians 6:9
9 Know ye not that the unrighteous shall not inherit the kingdom of God? Be not deceived: neither fornicators, nor idolaters, nor adulterers, nor effeminate, nor abusers of themselves with mankind,
In light of the above information, the problem that needs to be dealt with is how to become righteous enough to pass a judgement against a perfectly righteous standard.
In order to answer the above, what if a person, highly motivated, endeavors to become righteous via personal sacrifice, holiness, piety, and good works? The Bible explicitly warns against trying to justify yourself before God in this manner:
Romans 10:3
3 For they being ignorant of God's righteousness, and going about to establish their own righteousness, have not submitted themselves unto the righteousness of God.
Above, the distinction is made between someone's "own righteousness", versus "the righteousness of God". The righteousness of a human being, try as they may, is never perfect - therefore it is tainted in the sight of God:
Isaiah 64:6
6 But we are all as an unclean thing, and all our righteousnesses are as filthy rags; and we all do fade as a leaf; and our iniquities, like the wind, have taken us away.
In fact, the Lord says that even at a person's "best state", they are "altogether vanity" (Psalm 39:5).
This fact, coupled with all the verses above which plainly state that no one is "righteous", or "good", demonstrates that trying to please God with one's own personal righteousness is a doomed experiment that has never been accepted by God, for anybody. That's why we were warned against trying this method.
The Lord tells us that the entire reason for Jesus coming to earth was to make the perfect righteousness of God available to ordinary sinners:
2 Corinthians 5:21
21 For he hath made him to be sin for us, who knew no sin; that we might be made the righteousness of God in him.
When Jesus died on the cross, every single sin was placed on Him (1 Peter 2:24). This atonement is the basis for how one can become righteous before God.
In fact, the Lord even says that if it were possible to become righteous via any other means, then there would have been no reason for Christ to die on the cross, as His atonement would've been unnecessary:
Galatians 2:21
21 I do not frustrate the grace of God: for if righteousness come by the law, then Christ is dead in vain.
Therefore, we have seen that the Lord makes it clear that none are righteous, and that Jesus's atonement made the righteousness of God available to all in a way that obedience to God's commandments couldn't.
Now to the crucial point - if we are not righteous, and cannot be made righteous by the Law, how does obtain the righteousness of God that Christ made available?
To this end, the Lord tells us explicitly how we can obtain His righteousness, and therefore meet His perfect standard:
Philippians 3:9
9 And be found in him, not having mine own righteousness, which is of the law, but that which is through the faith of Christ, the righteousness which is of God by faith:
We, according to the above, obtain the righteousness of God Himself by faith, and not by obeying the Law, which as is demonstrated in this article, includes avoiding doing bad (1 John 3:4), and also includes anything good that you may do (Matthew 22:37-40). Therefore, we are made righteous without any human effort, either to do good, or avoid evil.
This message is reiterated clearly in Scripture - we are made righteous in the sight of God by faith, not works:
Romans 3:21-22
21 But now the righteousness of God without the law is manifested, being witnessed by the law and the prophets;
22 Even the righteousness of God which is by faith of Jesus Christ unto all and upon all them that believe: for there is no difference:
Romans 3:26
26 To declare, I say, at this time his righteousness: that he might be just, and the justifier of him which believeth in Jesus.
Romans 10:3-4
3 For they being ignorant of God's righteousness, and going about to establish their own righteousness, have not submitted themselves unto the righteousness of God.
4 For Christ is the end of the law for righteousness to every one that believeth.
Titus 3:5
5 Not by works of righteousness which we have done, but according to his mercy he saved us, by the washing of regeneration, and renewing of the Holy Ghost;
Romans 4:5-6
5 But to him that worketh not, but believeth on him that justifieth the ungodly, his faith is counted for righteousness.
6 Even as David also describeth the blessedness of the man, unto whom God imputeth righteousness without works,
Above we see that our own righteous works do not "contribute" to our righteousness before the Lord. Instead, our righteousness before the Lord is based entirely on faith in Jesus, instead of faith in ourselves to perform works of righteousness.
Therefore, the way that we obtain the righteousness of God is by faith in Jesus Christ. Then, the unrighteous are declared righteous in God's sight - not on account of their merit, but on the basis of Jesus's righteousness. Jesus's perfect righteousness has been imputed to us, as believers.
In summary, the Lord tells us that His standard is perfectly righteous, that none are righteous, that none can become righteous by the Law, and that the only way one can become righteous is to put their faith in Jesus Christ, who made the righteousness of God available to everyone by His atoning death for sin, and resurrection from the dead.
The perfect, untainted righteousness of God is given freely by faith to all believers, and this is the only righteousness that God will accept on Judgement Day, because it's the only righteousness that meets His perfect standard.