It was faith that made Noah hear God's warnings about things in the future that he could not see. He obeyed God and built a boat in which he and his family were saved. As a result, the world was condemned, and Noah received from God the righteousness that comes by faith.
God did not spare the ancient world, but brought the flood on the world of godless people; the only ones he saved were Noah, who preached righteousness, and seven other people.