Painful cost-cutting and rising sales to automakers help the nation's largest aluminum producer return to profitability.