"υμων τα καλα εργα" (your good works) and "την δικαιοσυνην υμων" (your practice of good deeds) are indeed synonymous.
However, there is no contradiction, since Jesus says in Matthew 5:16 we should do good works "οπως" (so that then) people (will) glorify God by seeing them, whereas Matthew 6:1 says we should not do good works "προς το θεαθηναι αυτοις" ([just] to be seen by them).
Jesus actually uses many seemingly contradictory statements in His teaching, whereas a simple examination shows a nuance. For example, "he who is not with me is against me," (Lk. 11:23) and, "he who is not against us is for us" (Lk. 9:50). At first glance, they seem to overlap and contradict, before you realize what is being said in each case.
Here, even if Jesus didn't use different wording, we would still know that He meant both instances: show your works to glorify God by letting men see, but don't show them just to be seen by men.