Eph 2:8-10 is often treated as the “clobber-text” employed by apologists for Sola Fide and Sola Gratia. Notwithstanding, the "works" in view here, as with Rom 4:4 and the use of the term "debt" (οφειλημα), are works where one tries to legally obligate God to give us salvation--this is anathema, as we cannot obligate God to "owe" us anything, let alone salvation. However, such does not condemn works within the realm of God's grace, as seen in many texts (e.g., Psa 106:30-31; Rom 2:5-10; cf. Heb 6:10).
New Testament scholar, Markus Barth, in his 1974 commentary on Ephesians, published as part of the Anchor Bible commentary series, on pp. 244-45, writes:
There appears to be some resemblance between the opponents fought in Ephesians 2:9 and those refuted in Galatians, Philippians, and Romans. Therefore, the "works" of these opponents can be more clearly defined as "works of law". . . .What are the "works of law" which Paul's opponents were "boasting" about? Because their works were connected with OT commandments and Jewish customs, and because they were obviously recommended to or imposed upon Gentiles, the adversaries of Paul are usually called "Judaizers". . . . In the New Testament the term "works of law" and polemics against "righteousness by law" occur only in contexts where the imposition of some [Jewish] legal elements upon the Gentiles is discussed.
Interestingly, the Greek word translated as "gift" in Eph 2 is δωρον, which refers to a gift in a form of a sacrifice, and in the context of the pericope, refers not to salvation per se, but to the sacrifice of Jesus Christ, which was a selfless act, not merited by human works. This fits grammatically with the use of τουτο, a demonstrative, which, like δωρον, is both neuter and singular; the demonstrative cannot refer to "faith" as πιστις is feminine while the participle "have been saved" (σεσωμενοι) is a masculine plural.
What is grace according to Paul? God looking away from one’s sins because of an imputation of Christ’s alien righteousness? No, according to Paul, grace is:
For the grace of God that bringeth salvation hath appeared to all men, teaching us that, denying ungodliness and wordly lusts, we should live soberly, righteously, and godly, in this present world; Looking for what blessed hope, and the glorious appearing of the great God and our Saviour Jesus Christ; Who have himself for us, that he might redeem us from all iniquity, and purify unto himself a peculiar people, zealous of good works. (Tit 2:11-14)
The very purpose of sending his Son in the context of salvation is to give grace which cleanses from sins. The purpose is not for him to look away from our sins because of an imputed, alien righteousness. One must work out salvation with fear and trembling in order to attain that resurrection of life (Phil 2:12-16) and any gospel that denies that is not the Gospel of Jesus Christ.
I would challenge anyone to look at any judgement scene in the Bible and find me any one scene where one goes to heaven based on faith alone and an alien righteousness. There is not one. Every single one that separates those from going to heaven and those going to hell is based on works and obedience to God. Look at Rev 20:12-13; 22:11-14; John 5:28-29; Matt 7:16-23; 16:24-27; 25:31-46; Rom 2:4-13; 1 Cor 3:10-17. Every single one of them makes this separation based on works and obedience; they are not in regard to only extra rewards or punishments. Only the active grace that God provides and when he looks through his eyes of grace is it possible to attain salvation. For a book-length discussion, see Chris Vanlandingham, Judgment and Justification in Early Judaism and the Apostle Paul (Hendrickson, 2006) for a refutation of the common claim among many Evangelicals that works, for the Christian, determine their rewards in the hereafter, not their final destinies, at the final judgement.
Something that is rarely discussed, especially among proponents of various “faith alone” theologies is the relationship Eph 2 has with Col 2. Ephesians and Colossians have very strong ties with one another, and many key passages in both epistles are to be read in light of the other to get the fuller meaning of Paul’s comments; furthermore, most scholars who hold to the authorship of one of these epistles almost universally holds to the authorship of the other (these are two of the six disputed epistles, the others being 2 Thessalonians and the Pastoral Epistles).
In the parallel text to Eph 2:8-10, we read the following:
In [Christ] also ye are circumcised with the circumcision made without hands, in putting of the body of the sins of the flesh by the circumcision of Christ. Buried with him in baptism wherein also we are risen with him through the faith of the operation of God, who hath raised him from the dead. And you, being dead in your sins and the uncircumcision of your flesh, hath he quickened together with him, having forgiven you all trespasses. (Col 2:11-13)
In this pericope, Paul states that those "in" (εν) Christ are circumcised with a spiritual circumcision (viz. water baptism [per v. 12]), and paralleling the language used in Rom 6:1-4, we are said to be buried together (συνθαπτομαι) with him "in baptism" (εν τω βαπτισμω), resulting in God freely forgiving (χαριζομαι) us of our trespasses. The only exegetically-sound interpretation is that this pericope teaches baptismal regeneration, not a merely symbolic understanding of water baptism. Of course, it is God, not man, who affects salvation and the forgiveness of sins through water baptism, as the Holy Spirit, through the instrumentality of baptism, cleanses us from sins and makes us into a new creature; it is not something merited by human works (see Titus 3:3-5). It is rather disturbing, and unfortunately, has led to a lot of eisegesis and heretical theologies, the concept that if a person does anything, they legally merit salvation. If I am handed a gift, do I “merit” the gift by putting my hands out to receive it? For some, the answer is “yes.”
It should also be noted that even in Ephesians, Paul teaches the necessity of water baptism. In Eph 5:26, speaking of Christ’s relationship to the Church, we read:
To make her holy, cleansing her by the washing with water through the word. (NIV)
In the Greek, this is a purpose clause, as evidenced by the use of the subordinating conjunction ινα. Christ is said to make holy (αγιαζω) and cleanse (καθαριζω) its members with the "washing of water." The term translated as "washing" is λουτρον, which is the term for a "bath" or even a baptismal font (cf. Song 4:2; 6:6; Sirach 34:25 in the LXX). This noun, being coupled with the phrase του υδατος "of water" shows that water baptism is the instrumental means through which Christ cleanses the members of His bride, the Church.
When read contextually, and in light of Col 2:11-13, as well as the entirety of Paul’s own writings, Eph 2:8-10 is not a “problem text” for Latter-day Saint soteriology, in spite of the incessant claims from many ignorant critics of the Restored Gospel.