Lewis Hamilton mastered the wet weather in qualifying to finish 1.2 seconds clear of the field in Austria.