When God delivered Israel from Egypt, a knowledge of His power spread far and wide, and reached the inhabitants of Jericho. Rahab herself informs us of the knowledge of these events.
And she said unto the men, I know that the LORD hath given you the
land, and that your terror is fallen upon us, and that all the
inhabitants of the land faint because of you. (Joshua 2:9, KJV)
For we have heard how the LORD dried up the water of the Red sea for
you, when ye came out of Egypt; and what ye did unto the two kings of
the Amorites, that were on the other side Jordan, Sihon and Og, whom
ye utterly destroyed. (Joshua 2:10, KJV)
And as soon as we had heard these things, our hearts did melt, neither
did there remain any more courage in any man, because of you: for the
LORD your God, he is God in heaven above, and in earth beneath.
(Joshua 2:11, KJV)
Centuries later, well after the Exodus, the priests of the Philistines reminded their people of the plagues of Egypt, and warned them against resisting the God of Israel.
And the Philistines were afraid, for they said, God is come into the
camp. And they said, Woe unto us! for there hath not been such a thing
heretofore. Woe unto us! who shall deliver us out of the hand of these
mighty Gods? these are the Gods that smote the Egyptians with all the
plagues in the wilderness. (1 Samuel 4:7-8, KJV)
Clearly, the knowledge of these events had been published widely among the surrounding nations.
Rahab, in choosing to harbor the spies--and to trust their promise, put her faith in their God. She even told them plainly: "for the LORD your God, he is God in heaven above, and in earth beneath." (Joshua 2:11, KJV)
She continued to demonstrate her faith in following the directions of the spies to hang a scarlet cord from her window during the assault on Jericho.
Behold, when we come into the land, thou shalt bind this line of
scarlet thread in the window which thou didst let us down by: and thou
shalt bring thy father, and thy mother, and thy brethren, and all thy
father's household, home unto thee. (Joshua 2:18, KJV
And she said, According unto your words, so be it. And she sent them
away, and they departed: and she bound the scarlet line in the window.
(Joshua 2:21, KJV)
Her actions showed that she truly believed, and this demonstration of her faith was the salvation of her entire family.
Conclusion
Rahab both confessed that the God of Israel was the true God, and followed the directions given her by the spies--whom she had risked her life to save. These actions showed her faith in God.