"How then can man be righteous before God? . . . "
This is a really good question, asked by Bildad the Shuhite. Man cannot do enough good works, to be made righteous before God. (We would have to do *every* good work possible, without exception, and without imperfection.) Fake gods and false religions cannot make us righteous before God. Being "better than average," or, "better than the other guy" certainly will not work--since God demands perfection, and absolute holiness.
There is only one way: the imputed righteousness of Jesus Christ, applied to souls who by grace exercise faith in Him, plus nothing. There you go, Bildad, that's how a man can be righteous before God.
[Puritan quote of the day: "He who sees Jesus Christ sees all the glory of paradise." --Thomas Watson, in his sermon, "The Saint's Desire to be with Christ"]