Romans 10:8-10 — But what saith it? The word is nigh thee, even in thy mouth, and in thy heart: that is, the word of faith, which we preach;
That if thou shalt confess with thy mouth the Lord Jesus, and shalt believe in thine heart that God hath raised Him from the dead, thou shalt be saved.
For with the heart man believeth unto righteousness; and with the mouth confession is made unto salvation.
Verse 8 is from Deuteronomy 30:12-23 — Moses said this in reference to the Law, but Paul uses it here to refer to the gospel.
The confession of Christ as Lord is the essential distinction between justification by faith and those who are attempting to achieve their salvation by works.
Confession here isn't promising to forsake sin, nor is it promising to make Christ Lord of your life (you can't do that until after He is in your life, which happens at salvation), but it is agreeing with Him that you can't obtain justification by any work of your own but must depend totally on Him by faith.
The English word "confess" means simply to "acknowledge," to "admit." And this is exactly what the original Greek word means too, nor does Romans 10:9-10 say anything about confessing before men … The heart and mouth in Romans 10:9 are both used symbolically. While believing is naturally associated with the heart, confessing is naturally associated with the mouth.
If indeed the Apostle meant that with the physical mouth public "profession" must be made for salvation, then salvation is not by faith alone after all, but by faith plus works … It is when the sinner comes to the end of himself and confesses, acknowledges that Jesus is Lord, and believes in Him as the risen, living Savior, that he is saved. Any work of righteousness he might add for salvation would be useless, for salvation is by grace … through faith … not of works (Ephesians 2:8-9). — C.R. Stam, The Epistle of Paul to the Romans, page 245-246.