Obedience verses works
Obedience to God includes good works for His glory but not all works qualify as obedience.
In fact some works are outright disobedience to God.
If one is obedient to God then the natural product of good works that bring God glory will be produced by the one who is obeying.
The rest is for the flames.