Being justified means - being "made just" or equitable, Strongs #1344.
Those who are justified are made just/equitable because God's grace teaches them to deny ungodliness - Titus 2:11 and 12.
Tit 2:11 ¶ For the grace of God that bringeth salvation hath appeared to all men,
Tit 2:12 Teaching us that, denying ungodliness and worldly lusts, we should live soberly, righteously, and godly, in this present world;
Being "righteous" does not mean that thereafter every action the person ever does is "right", it means that they did the right thing at that particular moment.
1Jo 3:7 (RSV) Little children, let no one deceive you. He who does "right" is righteous, as he is righteous.
Abraham had faith before scripture made the statement about Him in Genesis 15:6.
Abraham had faith and God considered that the "right" way to relate to Him.
Ge 15:6 And he believed in the LORD; and he counted it to him for righteousness.
The word "imputed" in the KJV is more clearly translated using the word "Reckoned" and the NKJV does recognize this as it translates James 2:23. Below both Bible translations of James 2:23 are pasted to illustrate this point.
KJV Jas 2:23 And the scripture was fulfilled which saith, Abraham believed God, and it was imputed (Strong's #3049)
unto him for righteousness: and he was called the Friend of God.
NKJV (New King James version) Jas 2:23 And the Scripture was fulfilled which says, "Abraham believed God, and it was accounted to him for righteousness." And he was called the friend of God. (NKJV)
KJV translation - Ga 3:6 ¶ Even as <kathos> Abraham <Abraam> believed <pisteuo> God <theos>, and <kai> it was
accounted <logizomai>
to him <autos> for <eis> righteousness <dikaiosune>. {accounted: or, imputed }
Strong's concordance number 3049. logizomai logizomai, log-id'-zom-ahee
Search for 3049 in KJV
middle voice from 3056; to take an inventory, i.e. estimate (literally or figuratively):--conclude, (ac-)count (of), + despise, esteem, impute, lay, number, reason, reckon, suppose, think (on).
New KJV translation - Ro 4:9 ¶ Cometh this blessedness then upon the circumcision only, or upon the uncircumcision also? for we say that faith was reckoned to Abraham for righteousness.
Ro 4:12 And the father of circumcision to them who are not of the circumcision only, but who also walk in the steps of that faith of our father Abraham, which he had being yet uncircumcised.
Ro 4:13 For the promise, that he should be the heir of the world, was not to Abraham, or to his seed, through the law, but through the righteousness of faith.
Ro 4:16 Therefore it is of faith, that it might be by grace; to the end the promise might be sure to all the seed; not to that only which is of the law, but to that also which is of the faith of Abraham; who is the father of us all,
Ga 3:7 Know ye therefore that they which are of faith, the same are the children of Abraham.
Ga 3:8 And the scripture, foreseeing that God would justify the heathen through faith, preached before the gospel unto Abraham, saying, In thee shall all nations be blessed.
It will take a while to adjust a persons thinking and view the concept of "Imputed righteousness" as God approving of the Faith Abraham had at the time and considering that the "right " thing to do.
Abraham was not at that moment given faith as the "word" imputed sometimes can imply. He was also not at that time stamped with the term "righteous" in every action He would ever perform.
He was only said to have done the "right thing at that particular moment. God recognized that He had faith and deemed that the correct or "right " way to do things.
It will also take a while to understand that the word "Justified" means "being "made just" as is used in the term "Justified by Grace".
Grace "justifies" a person because God's Grace teaches a person to "deny ungodly activity" and to be righteous or do the "right " thing.
To get into "works " a bit here. Some verses contrasting "works" with "Grace" are pasted below -
Ro 11:6 And if by grace, then is it no more of works: otherwise grace is no more grace. But if it be of works, then is it no more grace: otherwise work is no more work.
Ga 5:4 Christ is become of no effect unto you, whosoever of you are justified by the law; ye are fallen from grace. (KJV)
Ro 4:4 Now to him that worketh is the reward not reckoned of grace, but of debt. (KJV)
Ro 4:5 But to him that worketh not, but believeth on him that justifieth the ungodly, his faith is counted for righteousness. (KJV)
The verses referring to "works" do not mean we can't or even shouldn't do any works,
(Here refer to Phil 2:12 and the concept of - "working out your salvation").
The verses contrasting "works" with "Grace" mean that we/mankind are not capable of doing any work that will teach us to deny ungodliness, as the grace of God can teach us (Titus 2:11-12).
Ro 3:24 Being justified <dikaioo> freely <dorean> by his <autos> grace <charis> through <dia> the redemption <apolutrosis> that is in <en> Christ <Christos> Jesus <Iesous>:
Ga 5:4 Christ <Christos> is become of no effect unto you <apo> <katargeo>, whosoever of you <hostis> are justified <dikaioo> by <en> the law <nomos>; ye are fallen from <ekpipto> grace <charis>.
Tit 3:7 That <hina> being justified by <dikaioo> his <ekeinos> grace <charis>, we should be made <ginomai> heirs <kleronomos> according to <kata> the hope <elpis> of eternal <aionios> life <zoe>.
(KJV)
1344. dikaiow dikaioo, dik-ah-yo'-o
Search for 1344 in KJV
from 1342; to render (i.e. show or regard as) just or innocent:--free, justify(-ier), be righteous.