Does this mean that the old covenant (i.e., the Mosaic Covenant) was a covenant of works? No, we have already pointed out in previous sermons the peculiar feature of the Mosaic Covenant: while it was an administration of the covenant of grace, it included in it the Law and its works principle. Why? Paul explains in Gal. 3 that the law was added to the covenant of promise (i.e., the covenant of grace), which God made with Abraham. Notice: it was added to the covenant of promise, not given to replace the covenant of grace with a covenant of works. So Paul says, "Is the law then contrary to the promises of God? Certainly not! For if a law had been given that could give life, then righteousness would indeed be by the law. But the Scripture imprisoned everything under sin, so that the promise by faith in Jesus Christ might be given to those who believe" (Gal. 3:21-22).
As you can see, the law was added in order to expose Israel's (and the fallen man's) total inability to meet the divine demand for holiness and righteousness. But simply to chide and condemn Israel for its failure was not the ultimate goal. It was actually to drive the people of Israel to what the covenant of promise actually promised: our salvation through faith in Jesus Christ, the promised Offspring of Abraham. The law was a diagnostic tool to expose Israel's true spiritual condition so that it would turn to the divine Physician for healing and life.