From an historical Reformed perspective, the law/gospel distinction had to do with justification, and that's all. It did not pertain to sanctification, except insofar as it taught that sanctification flows from understanding the proper law/gospel distinction in justification, such that no one can think of his sanctification as any part of the ground of his justification (which would not produce true sanctification at all). So what was the law/gospel distinction? It was simple.
There is one ground of justification: perfect obedience to God's law. But, there are two ways to arrive at that ground. (1) You can render perfect obedience yourself (law) or (2) You can trust in Christ to render perfect obedience for you (gospel). That's it.
Now, it's critical to understand that in saying that the gospel has reference to Christ's perfect obedience for justification, the law/gospel folks were not saying that the gospel only has to do with justification. No, indeed. The gospel has to do with union with Christ and with the double blessings of justification and sanctification that flow from that union.
This classically Reformed and Lutheran formulation of the law/gospel distinction should be distinguished from the following improper distinctions.
1. Forms of dispensationalism and new covenant theology identify the Mosaic covenant (or even the whole Old Testament) with the law and the new covenant with the gospel. Reformed folks of most stripes vehemently object to this understanding of the law/gospel distinction because they understand that the terms of the Old Testament were not terms of the law, but the terms of the gospel. They believe that the whole OT was fundamentally gracious. The most important aspect of Reformed constructions of the law/gospel distinction has nothing to do with the relationship between OT and the NT in themselves but with the two ways of justification.
2. Some Lutherans have created a law/gospel hermeneutic, which is organized around the ideas of "command" and "promise." They say that every promise in the Bible is the gospel, but that every command in the Bible is the law. For believers, all of the promises of the Bible are unconditional, and we should not try to keep the law for promised blessings, but only and always keep the law from promised blessings. This is a terrible misreading of the Bible.
Now, there have been some objections to the law/gospel distinction. Here are a few of them in no specific order.
1. Karl Barth objected to it on the ground that there can be no works based relationship with God, since God cannot be obligated, even by His own character (apparently nominalism is lurking in the background). The Father's relationship to the Son is not one of merit, or works, but of gracious faithful obedience. So, Barth attacked the law/gospel distinction by going after its foundation: the notion that there is one way to be justified: perfect obedience to the law. Barth said all relationships with God rest on grace, not works. So, how are we justified? Not by trusting Christ and having his righteousness imputed to us, but by doing faithful though imperfect good works. Ironically, though Barth cries down a works relationship with God on the one hand, on the other hand, he insists on it.
2. Herman Hoeksema and others deny the classical Reformed law/gospel distinction because they have accepted part of Barth's thesis. While they affirm with the Reformers that the relationship of believers to God depends upon Christ's meritorious works, with Barth they deny that it is possible for human beings to work for their own justification, either hypothetically or in any period of history. It is interesting to note that while they deny the possibility of human merit, they affirm that sinners “earn” or “demerit” condemnation: “The wages of sin is death.” The logical result of this position is that justification is impossible without the imputation of Christ's righteousness, either before or after the fall.
3. Roman Catholics continue to object to the distinction on the ground that they believe that the gospel is God's gracious acceptance of the best efforts of Christians to keep the law. Believers try their best but sometimes sin and may be forgiven through the grace of Christ for their justification. As long as believers continue to strive for holiness, they will be justified in the end.