Francis Turretin (1623-87) on the necessity of good works as they relate to justification:
Although we acknowledge the necessity of good works against the Epicureans, we do not on this account confound the law and the gospel and interfere with gratuitous justification by faith alone. Good works are required not for living according to the law, but because we live by the gospel; not as the causes on account of which life is given to us, but as effects which testify that life has been given to us. (Institutes of Elenctic Theology, 2.705)
And here is Turretin on the necessity of good works as they relate to our final glorification:
For since good works have the relation of the means to the end (Jn. 3:5, 16; Mt. 5:8); of the “way” to the goal (Eph. 2:10, Phil. 3:14); of the “sowing” to the harvest (Gal. 6:7, 8); of the “firstfruits” to the mass (Rom. 8:23); of labor to the reward (Mt. 20:1); of the “contest” to the crown (2 Tim. 2:5; 4:8), everyone sees that there is the highest and an indispensable necessity of good works for obtaining glory. It is so great that it cannot be reached without them (Heb. 12:14; Rev. 21:27). (2.705)
So to summarize: good works are the effect of justification (not the cause) and the means to the end of glorification. And for the record, when Turretin speaks of “good works” he means that which is (1) done from faith, (2) according to the will of God in Scripture, (3) from the heart), and (4) for the glory of God (2.706).