Nico Rosberg will start from the clean side of a slippery Mexican grid after beating Lewis Hamilton to pole.