The German car maker benefited from cost cuts in its core autos division.