The stranded Interislander ferry Aratere has been successfully refloated.
The ship ran aground near Picton on Friday night after suffering a reported steering failure on a freight-only sailing.
No one was injured and there was no environmental damage, KiwiRail said.
Marlborough District Council said the refloat attempt commenced with the high tide around 9pm Saturday.
Two tug boats and the ferry's own propulsion were used to get it off the rocks.
While the council had earlier said the refloat attempt could take "several hours", the ferry was free of the shore by 9.30pm.
It had been towed to a safe anchorage point and would be re-ballasted and stabilised overnight.
"This will enable Maritime NZ to work closely with Aratere's Classification Society and KiwiRail to understand what has occurred, and what action needs to happen, before the vessel is able to move safely again and can be released."
Maritime NZ investigators would start an investigation into the grounding on Sunday, she said.
"They will carry out interviews, examine the scene and ferry, review documents and gather evidence.
"We will then decide what, if any, further action to take. The investigation is expected to take several months to complete."
The Transport Accident Investigation Commission and KiwiRail were also investigating the incident, which KiwiRail earlier said had been caused by a steering failure.
At this stage, he could not give a timeframe for the ship's return to service, he said.
"We are working with urgency to understand what has happened here.
"This is an incredibly unfortunate incident, especially coming after an intensive investment in an enhanced maintenance regime, supported by global asset management peer reviews during 2023 and 2024.
"Since then, we've had a solid run with reliability and on time performance and have generally been pleased with how our ships are performing."
Aratere is New Zealand's only rail ferry, meaning it can be used to transport trains across the Cook Strait.
Its grounding has severed the rail link between the North and South islands. It is not yet known what impacts this will have on freight.
Trucking body wants assurances
The grounding of the only rail ferry in the Cook Strait demonstrates how fragile the inter-island connection is, Transporting New Zealand says.
The Interislander ferry Aratere had been on a freight-only sailing on Friday when it suffered a steering failure and ran aground about 10pm.
It was refloated on Saturday night and will to safe anchorage in Picton Harbour Sunday.
Transporting NZ interim chief executive Dom Kalasih said the organisation needed assurances from the government that something would be done to provide a reliable service.
"The incident has really just demonstrated how fragile that link is," he said.
"We'll certainly be advocating hard for greater certainty from government as to what the plan is to make that link more reliable."
Kalasih said there should not be significant long-term impacts to freight networks because of the Aratere running aground.
KiwiRail chief executive Peter Reidy said any delays to the freight network would depend on how long the Aratere was out of service.
"We're working right now with our customers of the rail freight, getting it onto (Aratere's sister ship) the Kaitaki, to be able to move it across the Cook Strait, which we do regularly," he said.
"When Aratere is in a wet-dock or a dry-dock, we'll move it through the other ships."
In a statement, Reidy acknowledged the disruption the grounding had caused.
"We know this incident is extremely disruptive for our customers and appreciate their patience as we work with them to organise alternative arrangements," he said.
But Maritime Union spokesperson Victor Billot said there could be significant hold-ups to freight with Aratere out of service, as Kaitaki was not rail-enabled.
"Any freight going across the Cook Strait, if it's rail-based, it has to get put on trucks, then taken onto the ferries, then taken off the trucks, then put back on the rail," he said.
"That's not an ideal situation in terms of double handling, and emissions and so forth, and the time it takes, and the cost."
KiwiRail said it could not give a timeframe for the Aratere's return to service.
It said the ferry would not operate until it had been released by Maritime New Zealand, which was investigating the grounding.