Sebastian Vettel claimed a first ever win on home soil, but had to battle until the finish line at the German Grand Prix.