How were people in the Old Testament saved before Christ?

 “And he [Abraham] believed the Lord, and he counted it to him as righteousness.” Genesis 15:6
 The assumption that is usually made is that the way of salvation in the Old Testament must have been different than the way in the New Testament. That is, in my view, a poor assumption.
They were saved by grace through faith in the Messiah who was coming. What God did was apply the work that He would do in the future on the cross to the Old Testament saint. It’s was faith that saved Abraham (Genesis 15:6). It’s faith that makes all the Old Testament saints the sons and daughters of Abraham. The Old Testament saint believed God and it was counted for him or for her as righteousness. They were (and are) saved by grace through faith.
They could not see in the Messiah’s work all that we can now see on this side of the cross. But if full understanding of the benefits of Christ’s sacrifice is necessary for salvation, then who among us would be saved? We all have an imperfect and incomplete view of the finished work of Christ. Yet God applies that perfect finished work to our lives perfectly even though we have an imperfect view of what Christ did for us.
Just like the Old Testament saint, we respond in faith to the true God according to the light we’ve been given. And God graciously grants us double imputation – Jesus takes our sin and we get His righteousness.
Now, for those Old Testament persons who did not receive the gift of faith and, therefore, did not exercise the gift of faith, they were not saved… just like those who do not exercise faith today are not saved.
But for the Old testament saint who did exercise faith, he/she is saved by grace through faith. We must never fail to underestimate the importance of Genesis 15:6, “And he believed the Lord, and he counted it to him as righteousness.”
About Genesis 15:6, Matthew Henry says,
“Some think that his [Abraham’s] believing in the Lord respected, not only the Lord promising, but the Lord promised, the Lord Jesus, the Mediator of the new covenant. He believed in Him, that is, received and embraced the divine revelation concerning Him, and rejoiced to see His day, though at so great a distance, Jn. 8:56 . God counted it to him for righteousness; that is, upon the score of this he was accepted of God, and, as the rest of the patriarchs, by faith he obtained witness that he was righteous, Heb. 11:4. This is urged in the New Testament to prove that we are justified by faith without the works of the law (Rom. 4:3 ; Gal. 3:6 ); for Abram was so justified while he was yet uncircumcised.”
About Genesis 15:6, John Gill says,
“He [Abraham] believed in the promise of God, that he should have a seed, and a very numerous one; he believed that the Messiah would spring from his seed; he believed in Him as his Savior and Redeemer; he believed in Him for righteousness, and he believed in His righteousness as justifying him before God… and his faith received, even Christ and His righteousness this was imputed to him without works, and while he was an uncircumcised person, for the proof of which the apostle [Paul] produces this passage, (Romans 4:3 Romans 4:10 Romans 4:23 Romans 4:24).”
 These following posts from David Murray’s blog are really good on this topic. Murray is a Scot and an OT professor at Puritan Reformed Seminary and wrote, “Jesus On Every Page” and “The Happy Christian.”