Actually, what constituted good works
has varied throughout history. For centuries dispensations
were sold as a means of funding the church
. Liteally this implied that you could buy your way into heaven
regardless of how you had conducted your life. This view has been discredited generally, but still persists in some churches.
For an interesting view of this you may wish to read Graham Greene's novel Monsignor Quixote. The book portrays a festival where important places are purchased by rich families, leaving the poor alone. I think this falls partly under the special works doctrine listed in s alanet's post. But imperfectly so, a special work ought to have some spiritual significance greater than exchanging money for status.
I think faith is the key to attaining heaven. But not the sort of faith where you go to church on Sunday, pray now and then and that's it. A theology professor of mine once said, "A person's religion is the rules by which they live their lives." Belief has implications. If you have faith, you must act on it. It is by these actions that we witness our faith.
In essence good works the means by which we bring our faith into action, to show that belief is more than mouthing the words. To divorce one from the other is artificial.
Yet the question arises that what if a person lives a good life, performing good works out of a sense of duty rather than a desire for self-glorification? If you go by what my professor said, whatever his stated beliefs, by living a Christian life he has shown that he understands God, even if he will not say his name.
While this view would be attacked by some Christians, I think there is evidence of this in the life of Christ himself. In examining the New Testament one is struck by how often Christ lifts up those who are seen as outside or marginal in the Jewish society at the time of his life. The Good Samaritan, the lady at the well, the tax collector and lepers and more are all evidence that Jesus walked among the outsiders and estranged. It was the Temple priests who had him crucified after all.
By your deeds you shall know us. That applies to everyone no matter what their creed.