Moses himself was saved throught the grace of God in Christ, he was saved precisely the way we are in the Gospel Age, by grace through faith in the blood of Jesus.
The way of salvation by grace is given clearly in Jeremiah 31:31-34 as already shown in another answer: but another covenant to the covenant given at Mount Sinai is revealed even by Moses himself. I like the Good News Translation version, but all the Bible translations have the same idea:
These are the terms of the covenant that the LORD commanded Moses to make with the people of Israel in the land of Moab; all this was in addition to the covenant which the LORD had made with them at Mount Sinai. (Deuteronomy 29:1, GNB).
So Moses gave two covenants to the people, not one. He gave the covenant of works and he gave the covenant of grace. Both covenants were given as a gift, neither Israelites (nor the human race) earned the right to be told them: and, in that they are a gift given by a gracious, loving God, both of these covenants had (and have) a good, gracious, merciful purpose.
The LORD gave the covenant of works to show us we cannot save ourselves, to try to beat out of us our fallen self-righteousness, to show us the least sin makes us fit only for hell, to take out of us our hopes based on a hopeless foundation (viz our own righteousness), and to show that no work of ours can earn us the right to come back into a good relationship with God.
Before they heard the ten commandments given with thunderings, they thought themselves very capable of obeying God:
and all the people answered together, saying, all that the LORD has spoken we will do (Exodus 19:8).
But God was not pleased with this unrealistic self-righteous language. But once they see the lightening and hear the thunderings, etc, and are brought to a great fear, they cried out for a mediator,
and said to Moses, You speak to us, and we will hear, but let not God speak to us, lest we die (Exodus 20:19).
And God was pleased when they said this.
He gave the covenant of grace to show us how we can be saved by Another, to give us a hope built on a solid foundation: a Saviour's perfect righteousness and death for us (Genesis 3:15).
There are the gospels according Matthew, Mark, Luke and John; and there is "The Gospel According to Moses" in Genesis 37-50, given in allegory.
The consequences of failure under the terms of the covenant of works as described in the Law of Moses was often death. This was to show them (and us) that once we have failed under this covenant, then this covenant has no remedy: there is nothing we can do to get right with God while under this covenant. We need the Covenant of Grace.
Once we feel the poison of sin in us, that we are under sentence of death because of our own rebellious ways, and that all attempts at self-recovery are altogether hopeless, then we will be willing to listen to God and look to the remedy He has provided (Numbers 21:1-9, John 3:14-15), in the Covenant of Grace where we are saved by the work of another and where the power of sin in us is dealt a death-blow (Romans 6:14).
It was this covenant of grace that Moses preached to them in Deuteronomy 29-30. Chapter 29 contains much warning, but ch. 30 offers grace upon personal repentance from the heart. It was offered to them as individuals, both Israelites and foreigners (29:11-15). It is a repentance from the heart that God here is seeking (29:18, 30:2, 30:6, 30:10). With this repentance the LORD would show compassion (30:3). And God will change their hearts and cleanse them (30:6).
This is not the Covenant of Sinai, a covenant of works, but a different covenant, the Covenant of Grace.
So even Moses showed that the Law was not the way to be put right with God.
For more on this see: https://www.metropolitantabernacle.org/God-covenant-with-Moses