Dunn and Wright have argued that "works of the law" means the mosaic law in general but also connotes the specific commandments of sabbath keeping, food laws, and circumcision as emblems of Israel's election and requiring separation from the nations. I tend to think that "works of the law" means the "works which the law requires" but that point should not eviscerate the fact that doing the works of the law meant engaging in a form of law keeping that required separation from non-Jews and it was an expression of loyalty to one's ethnic identity. Committment to the law was not merely a theological conviction but a social stance as well. In other words, doing the "works of the law" meant keeping the Jewish way of life.
The following passage from Tacitus,
Hist. 5.5 illustrates very clearly the social stimga attached to keeping the
Torah:
"This worship, however introduced, is upheld by its antiquity; all
their other customs, which are at once perverse and disgusting, owe their
strength to their very badness. The most degraded out of other races, scorning
their national beliefs, brought to them their contributions and presents.
This augmented the wealth of the Jews, as also did the fact, that among
themselves they are inflexibly honest and ever ready to shew compassion,
though they regard the rest of mankind with all the hatred of enemies.
They sit apart at meals, they sleep apart, and though, as a nation, they
are singularly prone to lust, they abstain from intercourse with foreign
women; among themselves nothing is unlawful. Circumcision was adopted by
them as a mark of difference from other men. Those who come over to their
religion adopt the practice, and have this lesson first instilled into
them, to despise all gods, to disown their country, and set at nought parents,
children, and brethren. Still they provide for the increase of their numbers.
It is a crime among them to kill any newly-born infant. They hold that
the souls of all who perish in battle or by the hands of the executioner
are immortal. Hence a passion for propagating their race and a contempt
for death. They are wont to bury rather than to burn their dead, following
in this the Egyptian cus tom; they bestow the same care on the dead, and
they hold the same belief about the lower world. Quite different is their
faith about things divine. The Egyptians worship many animals and images
of monstrous form; the Jews have purely mental conceptions of Deity, as
one in essence. They call those profane who make representations of God
in human shape out of perishable materials. They believe that Being to
be supreme and eternal, neither capable of representation, nor of decay.
They therefore do not allow any images to stand in their cities, much less
in their temples. This flattery is not paid to their kings, nor this honour
to our Emperors. From the fact, however, that their priests used to chant
to the music of flutes and cymbals, and to wear garlands of ivy, and that
a golden vine was found in the temple, some have thought that they worshipped
father Liber, the conqueror of the East, though their institutions do not
by any means harmonize with the theory; for Liber established a festive
and cheerful worship, while the Jewish religion is tasteless and
mean."