Right, I think a lot of confusion comes because there are two kinds of works described in the Bible, as you said.
The first type of works are the workings of man. The actions of man, even when man tries to do good, can never achieve anything. The only thing that the works and actions of man can achieve is to dig himself deeper into his own pit. This is what Paul so accurately describes as man's hopeless situation, no matter what man does, his actions only take him further away from God. These type of works are the opposite of grace.
There is another type of works described in the Bible. They are the fruit of the Spirit and are the consequence of the Grace of Christ. These works are done through man but not by man. These works can only be manifest through the Holy Ghost working inside man, which is no work at all. Christ clearly states that we must show the workings of the Spirit if we are His.