Lewis Hamilton continued his fine form by winning the Bahrain Grand Prix, despite losing his brakes on the last lap.