What does Romans 4:5 mean?
Paul is showing the difference between being made right with God by works, as opposed to by faith. If we could be justified before God by works, Paul wrote in the previous verse, then God would owe us righteousness. It would be like our paycheck for services rendered: a transaction with the God of heaven. Paul has already demonstrated in Romans, however, that nobody can accomplish this work. Instead, we all sin and fall short of God's glory (Romans 3:23).Now Paul points to the opposite of earning something by work: receiving it as a gift. The difference comes in not laboring with a mind to "earn" or purchase that benefit. The one who receives a gift, as a gift, does not try to earn it. What would be the point? Instead, this person simply believes in the God who justifies the ungodly. His faith is what causes him to be declared righteous by God.
Paul has just given a new descriptor to God: "the one who justifies the ungodly." This is the entire point of the gospel of Jesus Christ. God does not wait for us to become godly, or righteous on our own apart from Him, before welcoming us into His family. Because of our faith in righteous Jesus, God justifies us in spite of our sinfulness. There is no greater gift than this.
Paul's point to his opponents, the Jewish religious leaders, is that this is from the teachings of Scripture itself and not something he has invented.