Luther was thinking of "salvation" only as life after death, and not of salvation as a change in a person's life that makes them whole - freedom from want; good health; freedom from oppression; and happiness - which is the meaning of The Lord ( as, for instance, in his sermon in Matthew 5).
In this narrow sense, Luther's statement about salvation by grace "alone" did not disagree with The Church's position that we are saved by the grace of God. When Luther implied by "grace alone" that nothing more needs to be done by a person (no work is needed) he could find in the scripture no support for his position, and when he translated the Bible into German, he changed the text from that in the Latin Vulgate to give scriptural support to his inspiration.
His followers, Melanchthon in particular, latched onto this idea and taught that anyone could do anything they liked and not lose their salvation by Grace, even murder. This resulted in rioting in Germany, the destruction of monasteries, and marriage of nuns. About 100,000 people died in the rioting. This was not what Luther expected to happen.
Eventually common sense prevailed, the rioting ended, and Germany became Protestant, and abandoned their support of the Roman Church - money, and manpower for the Papal war machine.
But when salvation is understood in the way The Master taught, we see that it comes from following the teaching of God.
As The Master has said:
“For I say unto you, That except your righteousness shall exceed the righteousness of the scribes and Pharisees, ye shall in no case enter into the kingdom of heaven.” Matthew 5:20, KJV.
If we look at ST. Augustine's theology on salvation we find this:
Wace and Piercy "A dictionary of Christian Biography"
In St. Augustine's letter to Deogratius (Ep. 102):
At all times, he writes, since the world began, the same faith has been revealed to men, at one time more obscurely, at another more plainly, as the circumstances altered; but what we now call the Christian religion is but the clearest revelation of a religion as old as the world. Never has its offer of salvation been withheld from those who were worthy of it even though they might not be mentioned in the sacred record. Such men who followed His commands (however unconsciously), were implicit believers in Christ. The changing (and therefore semi-real) form represents the one constant reality, the saving grace of God, revealed through the passion and resurrection of Christ (Ep 189 )