A profit beat driven by stronger margins lifted shares in late trading despite a small sales shortfall versus estimates.