This idea of imputation is indeed critical to understanding the biblical doctrine of justification. The word imputation in itself is a legal term. It means to reckon to the account of another. The previous observation dealt with Christ's substitutionary work on our behalf. Imputation is the outworking of this substitutionary work.
In regards to justification, imputation works in two ways. We talked earlier about Christ dying in substitution of our place. This is one of the ways in which imputation is present in the Gospel. Our sins are imputed upon Christ. In other words, even though Jesus was perfect, He became a curse for us (Galatians 3:15) and our iniquity was laid upon Him (Isaiah 53). This is the negative aspect of imputation. Christ has taken upon our sins. Our sins deserved God's wrath, but the wrath that we deserve was reckoned to Jesus on the cross. That is why Jesus had to suffer the way he did, because our sins were imputed to Him.
The positive aspect of imputation is the imputation of Christ's righteousness to believers. By the righteousness of Christ, I am referring to the merit that Christ possesses based upon His perfect life of obedience and His divine sonship.
Martin Luther called this concept the 'great exchange'. Christ took upon himself our sins and unrighteousness, and in exchange we receive Christ's perfect righteousness. Both of these are imputed.
This idea of righteousness being 'imputed' or 'reckoned' to us is seen all over Scripture. For example,
With Abraham: "Abraham believed God, and it was credited to him as righteousness" Genesis 15:6
With David: " Blessed is the man to whom the LORD imputes no iniquity" Psalm 32:1-2 (RSV, quoted in Romans 4:8)
With Isaiah: "Out of the anguish of his soul he shall see and be satisfied; by his knowledge shall the righteous one, my servant, make many to be accounted righteous, and he shall bear their iniquities." Isaiah 53:11
With Paul: "Now to the one who works, his wages are not counted as a gift but as his due. And to the one who does not work but believes in him who justifies the ungodly, his faith is counted as righteousness" Romans 4: 4-5
The reason that righteousness must be imputed or reckoned to us, is because it is an 'alien righteousness'. In other words, it is a righteousness that we haven't earned. This is so because in our own power and will, we could never live a perfect life of righteousness that merits a right standing with God. Therefore, it must be a righteousness apart from us, that is freely bestowed upon us. The righteousness is the righteousness possessed by Christ. Chris lived the perfect life that we should have lived. Christ is the perfect son that Adam was supposed to be. God the Father says of Jesus, "This is my beloved Son in whom I am well pleased" (Matthew 3:17). When we come to faith in Jesus, we receive this merit. God now sees us and treats us as beloved sons. This is not accomplished by works. It is a gift that is imputed to us out of God's benevolent grace. Though we are broken, sinners, God graciously bestows upon us, or imputes to us, a righteousness and a position of sonship that we could have never earned. This is good news. I end with a verse I know I've posted a few times already, but it is a verse that so clearly lays out justification.
"For our sake he made him to be sin, who knew no sin, so that in him, we might become the righteousness of God."
2 Corinthians 5:21