Dietrich Bonhoeffer explains this exquisitely in his book Discipleship. I'm sure I'm going to maul this, but basically his argument goes like this:
1) In Matthew 5, we are told that we are to do good works to glorify God.
2) In Matthew 6, we are told to hide our good works such that people do not see that we are the ones who do them.
3) Of very important note, Jesus says "do not let your left hand know what your right hand is doing".
4) Thus we are to hide our good works even from ourselves, such that we do not even see them.
He argues that works are only good insofar as we are unaware of them even ourselves, lest our pride corrupt them.