But if you are led by the Spirit, you are not under the law.
The Spirit of God is the Holy Spirit.
The Spirit of God is a Person, not a mere spiritual force.
The Spirit of God breathed out the OT Law just as surely as He breathed out the NT.
The law of God is in harmony with the principle of living under the leading of the Holy Spirit. They are not in conflict nor are they contrary to one another.
The problem is us and our sinfulness. We are not holy, but God is, and so is His law.
The solution to this dilemma of not being able to live under the law is provided for us.
Christ set us free from the condemnation that came from breaking God's law.
It is the Holy Spirit who leads us into the paths of righteousness for His name's sake. (Ps. 23)
So much more could be said, but Paul is NOT saying that we are now free to sin. He is NOT saying that the Spirit will lead us in ways contrary to the Word of God. Some have shipwrecked their faith by thinking that now they can just follow whatever impulse they wish, calling it being "led by the Spirit."
We are now free to follow God from the heart. Earlier in this passage Paul said that it was for freedom that Christ set us free. We are free from the law. We are free from sin. We are free to be led by the Spirit into all truth. If we are set free from sin, we will not want to turn back to a sinful lifestyle. If we are free from the law, we will not want to turn back to a slavish religion. If we are free to be led by the Spirit, then we will desire the things of the Spirit. Later Paul gives us the list of the fruit that being led by the Spirit produces in a person's life.
These are just random thoughts. If you think that I have misunderstood what Paul means here, then please look into it yourself. There is a double danger. One is that a person will throw out all law - which is antinomian, a form of moral anarchy. The other danger is that of legalism, which Paul is refuting here in the book of Galatians.
If one is truly led by the Spirit, then he or she will be moving towards holiness and will be demonstrating the fruit of the Spirit in his or her life.