Evaluating when a queen sacrifice offers compensation is one of the most difficult tasks in chess. Here it seems that White has a significant material advantage, with queen against rook and bishop (and Black doesn't even have a pawn for that), however the compensation is completely adequate thanks to the very well-placed black pieces. Note that the doubled pawns are not exactly a weakness here, as they ensure the stability of the black position (a knight cannot go to g5, for example) and make the king safer. In the history of chess no player has been as brilliant at assessing unbalanced positions as Garry Kasparov—there are many wonderful examples of his on this topic.
25. d4a7  25... b7b6  26. a7a6  26... c8a8  27. a6b5 