The Pasuk says (32:4) "HaTzur Tamim Pa'aloi Ki Chol Dirachav Mishpat, Kel Emuna V'Ein Avel; Hashem action are flawless, for all His ways are just, Hashem is faithful without any injustice." Injustice? We talk about how righteous Hashem is, it seems strange to mention that Hashem in not "unjust".
Rav Shach says from the Vilna Gaon that it is impossible for humans to take into account all surrounding circumstances and dispense perfect justice. For example, when someone commits a crime that requires the death sentence, has the court also determined if his children deserve to be orphans or not? What about the person who he says hello to every morning, has the court figured out if they can compensate that person for the loss they are inflicting on them.
When Hashem dispenses judgement, He has accounted for everything from the most glaring consequences to the most minute nuance. This is truly a tribute that we humans can marvel at. Hashem's justice system is pure justice, without the slightest trace of injustice.
הרב יצחק פנגר מספר: למה באמת חזרתי בתשובה