That is the ONLY way we can be declared as righteous as God - He IMPUTES His righteousness to our account. There IS no other way!
How awesome God is!
He knows we can’t be righteous enough on our own, so He forgives us of our sin and says, here, take my righteousness and gives it to us as a gift, so we can stand before Him.