Show your good works

Let your light so shine before men, that they may see your good works, and glorify your Father which is in heaven. ... Take heed that ye do not your alms before men, to be seen of them: otherwise ye have no reward of your Father which is in heaven. Mt. 5:16; 6:1
At first, these two passages may seem to be saying the opposite thing, and both within the course of a single sermon! In Mt. 5:16, our Lord is telling us that we should not hide our good works but let others see them. In 6:1, our Lord is telling us to not let our good works be seen (alms in 6:1, and then prayer in 6:5, and fasting in 6:16). How do we put these two things together?
I think the main thing is the motive behind our actions, isn't it? In 5:16, the motive is to be salt and light for the Lord "that they may . . . glorify your Father which is in heaven." But in chapter 6, our Lord is warning us against doing good works, not to glorify God, but to glorify ourselves. Such a motive hijacks our good works and twists them into something ugly. Instead of wanting to point others to God, we are trying to point others to ourselves, which is the worst possible thing we could do. People don't need us, after all; they need God.
Another difference here is the difference between hiding our good works out of the fear of men (after all, 5:16 comes almost immediately after 5:10-12 when our Lord speaks of being persecuted for righteousness' sake) and displaying our good works in seeking the favor of men. This has it backwards: we need to fear God and seek his face, not men. If we seek to please men, we cannot be the servants of Christ (cf. Gal. 1:10).
Finally, our Lord is showing that if our religion is real (unlike the scribes and Pharisees whose religion was only superficial) there is going to be a significant aspect of our life before God that no one can see. For if we truly do love God and trust in him, we are going to seek him not only in public but also in private.
Dear friend, is this true of us? Is the glory of God the motive in all that we do, both in terms of our public acts of worship and our private devotions? We have a wonderful promise from God when we are so motivated: for he has promised to reward us. And the blessing of the Lord is that which makes rich and he adds no sorrow with it.