What does Romans 2:7 mean?
God's Word was not written in tiny pieces, nor was it meant to be studied and understood in fragments. Chapters and verses make finding certain words easier, but they are not part of the original text of Scripture. The words of any particular verse have to be understood in the context of the rest of that passage, and chapter, and book. This verse may seem, at first glance, to contradict what we understand to be the good news: salvation by God's grace through faith in Jesus Christ, and not through human good works (Ephesians 2:8–9).However, it's important to follow Paul's full train of thought, instead of taking verses out of context. Paul is building the case for salvation by God's grace through our faith in Christ alone, and apart from anything we could ever do to earn it. Paul's point here sets up the truth of the gospel, it does not contradict it.
Having said that, Paul describes something that is absolutely true. God will judge each of us according to our works. For those who are saved, God does judge our works for the purpose of determining heavenly rewards (2 Corinthians 5:10). Further, if someone was able to seek glory and honor and immortality by persistently doing good works, God would absolutely give to that person eternal life. A perfectly truthful, sincere person would follow God's will perfectly for their entire life—and that would mean salvation. In reality, however, nobody will do that (Romans 3:23). A parallel application of this verse is that those who truly, honestly seek the will of God will find that will fulfilled in Jesus Christ (Matthew 7:7–8).
The point Paul is building towards is that no person, not a single one of us, can lead such a perfect life. We don't have it in us to persistently do good in that way. In the following chapter, Paul will quote Old Testament Scripture to show that "no one does good, not even one" (Romans 3:12) and that "all have sinned and fall short of the glory of God" (Romans 3:23).