Job may have considered himself to be a righteous man, especially when he measured himself against the other people in his world. But that approach is fundamentally flawed—it's like comparing one crooked stick to an even more crooked stick.
Unfortunately, it's very easy to practice a crooked-stick theology at work. We're surrounded by people who seem more righteous or less righteous than we are. We deal with people every day who have more or less power, intelligence, influence, or wealth than we do. When we compare ourselves to people who have less than we do, we feel better about ourselves. And when we compare ourselves to those who are better than we are, we feel worse about ourselves. It's a natural response. The only problem is that in the grand scheme of things, such comparisons are meaningless.
God is the only true measuring stick. If we measure ourselves against any of the questions God asked Job, we always come out looking very small. If we measure anyone else—no matter how powerful, intelligent, or influential he or she may be—against the questions God asked Job, that person will come out looking very insignificant, too.
It was only when Job was finally confronted with the greatness of God that he realized how inadequate he actually was. The same applies to us today. If we continually compare ourselves to people who are a little bit worse than we are, we will never experience the greatness of God. It's only when we turn our attention away from others and focus on God that we can truly understand how great our God really is.
Have you been comparing your righteousness to others'? If so, delve into Scripture passages that proclaim His glory (Job 38-42, Isaiah 6, among others) to remind yourself of God's greatness.