When people ask this question it's usually because they are thinking that God must require something of them in order to declare them right with him. Surely since we sinned we have to pay God back somehow? This thought probably stems from a good heart in that they realise the enormity of their sins against God and are convicted about change. The next thought then is often that what is required of them must be to keep the Ten Commandments as that is a ready package of works to do!
Paul spends most of the book to the Romans showing that the works of the Law will only lead to death because you cannot keep the Law perfectly and only perfection in your works could get you eternal life. And, he ensures that you know which Law he's talking about by giving examples in Rom 7:7-8 and other places which prove that the Law he's referring to is the Ten Commandments.
Rom 3:19-20 Now we know that whatever the law says it speaks to those who are under the law, so that every mouth may be stopped, and the whole world may be held accountable to God. For by works of the law no human beingc will be justified in his sight, since through the law comes knowledge of sin.
But which law is Paul speaking about? Which law is it that attempting to keep it will not bring justification?
Romans 7:7 What shall we say then? Is the law sin? Certainly not! On the contrary, I would not have known sin except through the law. For I would not have known lust unless the law had said, "You shall not covet".
This Law (the ten commandments) can only condemn you and show you that you are guilty when you transgress, it cannot save you or make you righteous. Paul tells us that we as Christian believers are now dead to this Law code and should not be doing it's works.
Gal 2:19-20 For through the law I died to the law, so that I might live to God. I have been crucified with Christ. It is no longer I who live, but Christ who lives in me. And the life I now live in the flesh I live by faith in the Son of God, who loved me and gave himself for me. I do not nullify the grace of God, for if righteousnessc were through the law, then Christ died for no purpose.
James though in his writing tells us that 'works' are a natural outcome of real saving faith. The question then is what does James mean by works? Is he referring to the same Law as Paul? Well James also gives examples of the works he is referring to. We can see this in Jam 2:14-16...
James 2:14-16 My brothers, what profit is it if a man says he has faith and does not have works? Can faith save him? If a brother or sister is naked and destitute of daily food, and if one of you says to them, Go in peace, be warmed and filled, but you do not give them those things which are needful to the body, what good is it?
We see straight away that James is not referring to the works of the Ten Commandments. He is referring to 'good works' that flow from faith through grace. Works like "feeding the poor", "looking after the sick", and other godly benevolent things. Notice where this comes from.
Matthew 25:34-36 Then the King shall say to those on His right hand, Come, blessed of My Father, inherit the kingdom prepared for you from the foundation of the world. For I was hungry, and you gave me food; I was thirsty, and you gave Me drink; I was a stranger, and you took Me in; I was naked, and you clothed Me; I was sick, and you visited Me; I was in prison, and you came to Me.
These are the works that James is talking about. Works of faith that stem NOT from the Law of Moses, but from the Law of Christ. These are the works which Jesus Christ commended to his disciples. They are works which are expected of us as followers of Jesus and which demonstrate our faith. Faith in Christ that as we help others, even sacrificing to follow the leading of the Holy Spirit, that God will repay!
So, what can we do to be saved? Nothing! Except, believe on the Lord Jesus and follow the guide that He has given us - Holy Spirit!
So, having been saved by the free gift of God, we are expected to do His 'good works' which He has prepared for us. We don't do them to make ourselves righteous. We do them because Jesus has already made us righteous!
Best wishes for Grace and the Peace of Jesus.