The automaker said it had kept a “tight grip” on costs as it focused on more profitable models including in its Maybach and performance AMG brands.