Faith basically. Works is essential as well but what gives you salvation is not that work, but faith.
Think of that criminal at the stake/cross. What saved him? Works? No, just faith in Jesus.
Think about those whom Jesus told when he was on earth, "your sins have been forgiven". That means had the kingdom come that day, they will be saved. What saved them, works? No. Faith.
What about many persons that were baptized those days, they didn't live many years studying What Does The Bible Really Teach book and then having their lives policed to determine if they are repentant before they were baptized. All they needed was to believe in Jesus and state that they have repented, they were baptized. In the case of Cornelius and those invited for the occasion, they received the holy spirit immediately. Don't imagine that those were spotless.
Works are essential, but nothing can deter God from declaring any sinner righteous and beckon him to the kingdom through the ransom sacrifice of Jesus. Nothing. So it's not good to think that one can earn salvation which works seem to emphasize. Neither would it be fine to deliberately become wicked in words and action and think that just having faith in Jesus will cover you. No.