Lewis Hamilton was left “gobsmacked” after positioning himself at the front of the grid for the first time as a Ferrari driver by topping Sprint Qualifying.