Novak simply played better and won.
I think Novak was the better player in that match ... but he might have lost it anyway, for a few centimeters.
Usually, despite the luck involved, the better player wins.
But it's not always true.
And even the concept of "the better player" is not always clear when players are so near