Jesus is pretty clear about it. Let’s look at the Parable of the Sheep and the Goats.
King James Version (KJV)
31 When the Son of man shall come in his glory, and all the holy angels with him, then shall he sit upon the throne of his glory:
32 And before him shall be gathered all nations: and he shall separate them one from another, as a shepherd divideth his sheep from the goats: 33 And he shall set the sheep on his right hand, but the goats on the left.
When Jesus comes to judge the world, He shall first separate the good from the wicked. The sheep are the good. The goats are the wicked.
34 Then shall the King say unto them on his right hand, Come, ye blessed of my Father, inherit the kingdom prepared for you from the foundation of the world:
Then, He addresses the sheep and He tells them that they are going to heaven.
35 For I was an hungred, and ye gave me meat: I was thirsty, and ye gave me drink: I was a stranger, and ye took me in:
36 Naked, and ye clothed me: I was sick, and ye visited me: I was in prison, and ye came unto me.
Then, He tells them why they are going to heaven. BECAUSE they have done so many things for Him.
37 Then shall the righteous answer him, saying, Lord, when saw we thee an hungred, and fed thee? or thirsty, and gave thee drink?
The sheep are confused. They reply, “But when did we see you, Lord?”
38 When saw we thee a stranger, and took thee in? or naked, and clothed thee?
39 Or when saw we thee sick, or in prison, and came unto thee?
40 And the King shall answer and say unto them, Verily I say unto you, Inasmuch as ye have done it unto one of the least of these my brethren, ye have done it unto me.
And Our Lord, replies to them, “Whenever you did something good for anyone in need, you did it for me.”
That’s pretty straightforward. You are going to heaven because you did good and cared for your fellow man.
Ok, now He turns to the goats and says:
41 Then shall he say also unto them on the left hand, Depart from me, ye cursed, into everlasting fire, prepared for the devil and his angels:
Get away from me because you are going to hell.
42For I was an hungred, and ye gave me no meat: I was thirsty, and ye gave me no drink: 43I was a stranger, and ye took me not in: naked, and ye clothed me not: sick, and in prison, and ye visited me not.
Then He tells them why they are going to hell. BECAUSE they have never done anything good for Him.
44Then shall they also answer him, saying, Lord, when saw we thee an hungred, or athirst, or a stranger, or naked, or sick, or in prison, and did not minister unto thee?
The goats are confused, and ask, “But, we don’t remember seeing you, ever?”
45Then shall he answer them, saying, Verily I say unto you, Inasmuch as ye did it not to one of the least of these, ye did it not to me.
And, Our Lord replied to them, “Whenever you saw someone in need and did nothing to help, you did not help me.”
46And these shall go away into everlasting punishment: but the righteous into life eternal.
And the goats are condemned to hell, while the sheep inherit everlasting life.
Note that the goats did nothing. They did nothing at all. They did not commit any evil sin. They did not jump on or beat up the innocent. They did not steal their food. They simply did nothing at all.
Note also that they called Jesus, Lord.
Another, very similar Teaching, is here:
Matthew 7:21 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.22 Many will say to me in that day, Lord, Lord, have we not prophesied in thy name? and in thy name have cast out devils? and in thy name done many wonderful works? 23 And then will I profess unto them, I never knew you: depart from me, ye that work iniquity.
So, if you want to go to heaven, remember:
Faith without works is dead, being alone. (James 2:17)