score:6
Nice question! I think the key here is to look at the context. Both quotes are included in The Sermon on the Mount (Matthew 5-7); both are spoken by Jesus and probably both were spoken on the same day.
Matthew 5
First the context. Jesus says (in Matthew 5:13-16):
‘You are the salt of the earth. But if the salt loses its saltiness, how can it be made salty again? It is no longer good for anything, except to be thrown out and trampled underfoot.
‘You are the light of the world. A town built on a hill cannot be hidden. Neither do people light a lamp and put it under a bowl. Instead they put it on its stand, and it gives light to everyone in the house. In the same way, let your light shine before others, that they may see your good deeds and glorify your Father in heaven.
I interpret this to mean we should be doing good deeds for other people because this will encourage them to glorify God. So our motivation is to help people to turn to God, not to bring glory to ourselves.
Matthew 6
Again the context; Jesus says (in Matthew 6:1-4):
‘Be careful not to practise your righteousness in front of others to be seen by them. If you do, you will have no reward from your Father in heaven.
‘So when you give to the needy, do not announce it with trumpets, as the hypocrites do in the synagogues and on the streets, to be honoured by others. Truly I tell you, they have received their reward in full. But when you give to the needy, do not let your left hand know what your right hand is doing, so that your giving may be in secret. Then your Father, who sees what is done in secret, will reward you.
This clarifies what I said above - the glory should not go to us. But note this is specifically talking about giving. If a number of people give to a church (or temple or synagogue, in this case), then the church can then in turn give to the needy. The recipients will then hopefully praise God, knowing only that this was given in His name but not knowing specifically by whom.
Giving can be anonymous in a way that other forms of light (eg visiting the sick or those in prison) are not.
Also, giving (like the things that follow in chapter 6: prayer and fasting) is between you and God - so only God needs to know about it.
Upvote:5
There are a couple distinctions. The first one has to do with how many people need to know. In Matthew 6, the needy person obviously knows what you have done when you give to them, but you don't have to proclaim it to everyone else. They don't need to know. So, give to the needy, and the needy will receive it and know what you have done. Just don't give in such a way that everyone sees it.
In the Matthew 6 passage, Jesus also mentions prayer. Many religious leaders would pray to God so loudly that everyone else would hear them--solely for the purpose of sounding pious. They don't need to hear it, and praying for show is praying for the wrong reason. So, if you want to pray to God, then pray to God. To put it another way, when you pray, pray so that God hears you--not everyone else.
Another distinction should be noted. This regard who is glorified. In Matthew 5, it is noted that it is the Father who is glorified--not us. In Matthew 6, the issue concerns gaining glory for oneself.
So, do good to the needy and to your neighbors in general. They will certainly know that you are being good to them. Forgive them, serve them, and love them. However, don't post on Facebook how much what you've done so that everyone can see how great you are.