KiwiRail said a maintenance vehicle came into contact with overhead powerlines between Newmarket and Britomart about 1.40am today.
St John earlier said one of the workers was in critical condition and the other was seriously injured.
KiwiRail general manager Jon Knight said just after midday that one workers had been discharged from hospital; the other was in a stable condition at Middlemore.
Britomart train station was closed and the Onehunga line suspended this morning. Most trains were running at a reduced 20-minute frequency and stopping at Newmarket.
After reopening Britomart shortly after midday, Auckland Transport said all trains would be running "to their normal timetables by 1pm".
KiwiRail said power had been isolated in a section of the rail network for inspections on the overhead power systems to take place as part of routine maintenance.
"Overhead power was turned off for the planned maintenance work being undertaken last night," Knight said. "Safety for our staff and the public is always our top priority and we are working to understand what led to this unfortunate incident."
WorkSafe had been notified and was making inquiries.