The company delivered better earnings than expected in the fourth quarter, breaking a recent pattern of disappointments.