Only by obeying the Gospel of Jesus Christ; that is, by doing what He has commanded. There is no other way. St. Paul says of Christ:
"Being made perfect, he became the author of eternal salvation unto all them that obey him." (Hebrews 5: 9).
The Savior Himself says:
"Not every one that saith unto me, Lord, Lord, shall enter into the kingdom of heaven; but he that doeth the will of my father which is in heaven." (Matthew 7: 21).
"If ye love me, keep my commandments." (John 14: 15).
"He that hath my commandments, and keepeth them, he it is that loveth me: and he that loveth me shall be loved of my Father, and I will love him, and will manifest myself to him." (John 14: 21).
SHALL WE BE JUDGED ACCORDING TO OUR BELIEF OR ACCORDING TO OUR OBEDIENCE?
The scriptures tell us that every man will be rewarded according to his works.
"For the Son of man shall come in the glory of his father with his angels; and then he shall reward every man according to his works." (Matthew 16, 27).
"Who will render to every man according to his deeds: to them who by patient continuance in well doing seek for glory and honor and immortality, eternal life: but unto them that are contentious, and do not obey the truth, but obey unrighteousness, indignation and wrath." (Romans 2: 6, 7).
"And I saw the dead, small and great, stand before God; and the books were opened; and another book was opened, which is the book of life: and the dead were judged out of those things which were written in the books, according to their works. And the sea gave up the dead which were in it; and death and hell delivered up the dead which were in them: and they were judged every man according to their works. (Revelation 20: 12, 13).
WHAT WILL BE THE PENALTY OF DISOBEDIENCE?
The Apostle Paul says the Lord Jesus will take vengeance upon those who obey not the Gospel of Christ.
"And to you who are troubled rest with us, when the Lord Jesus shall be revealed from heaven with his mighty angels, in flaming fire taking vengeance on them that know not God, and that obey not the gospel of our Lord Jesus Christ." (II Thessalonians 1: 7, 8).