Margin rebuild ahead of plan as electronics firm beats forecasts