Lewis Hamilton secured his first pole position in four months after beating fierce rival Nico Rosberg in final qualifying for Sunday's Italy Grand Prix in Monza.