In Catholicism, there is initial justification which is by grace only and there are also progressive and final justification. See two Jimmy Akin EWTN articles:
Notice that Eph 2:8-9 is in past tense referring to initial justification. During progressive justification (which in Catholic understanding is an ontological righteousness we possess incrementally IN ADDITION TO the initial justification which is discrete, one-time, 100% grace, and "legal"), believers still need to cooperate with the Holy Spirit until death instead of quitting mid-way (see warnings in Heb 4:1, 1 Cor 10:12, Rom 11:21-22), resulting in fruits of faith (aka "good works", cf James 2:14-26) done in a state of grace, enabled by the grace given by the Holy Spirit who lives inside believers.
Catholic Answers article Faith and Works: Understanding Ephesians 2:8-9 article by Jimmy Akin points out the subsequent verses Eph 2:10 which brings in the good works we need to do for progressive / final justification:
The sense of what Paul is saying is: “God has raised up both of us—Jews and Gentiles—to sit in the heavenly places in Christ Jesus, for we received initial salvation as a gift. We obtained it by faith in Christ (which itself is a gift from God), not by works of obedience to the Mosaic Law. So neither Jew or Gentile can boast over the other of having privilege with God. “Instead, we Christians are the result of God’s work, for he created us anew in the body of Christ so that we might do good works-the kind of works we should be concerned about-for God intended ahead of time for us to do them” (paraphrase of Eph. 2:6-10)