The Trans-Pacific Partnership has been put at peril by one country after leaders came achingly close to striking a deal last night.
Officials are now scrambling to revive the stalled trade pact after a series of meetings in Vietnam.
Speaking in Danang, Trade Minister David Parker said ministers thought a deal had been struck when their meeting finished about 10pm on Thursday night.
But in a "somewhat surprising" development, once it was passed on to officials, it emerged one country was still holding out.
"There was celebratory clapping and back-slapping," Mr Parker said.
"It was then turned over by ministers to officials ... and one of the parties said that they had not reached agreement."
Mr Parker would not name the country responsible, but denied it was either New Zealand or Canada.
"It's not New Zealand holding up the consensus. We reached agreement."
He also declined to reveal the sticking point, but said it was "an issue of contention for many parties in the room".
It was unclear whether the dispute could be resolved.
"It's in the wind," Mr Parker said.
Japan's delegate would oversee the efforts to resolve the matter and would deal directly with other nations' leaders.
New Zealand had been seeking some last minute changes to stop foreign corporations suing governments in overseas tribunals.
Mr Parker said Labour had got "some of what we wanted" and the issue had been "improved but not completely resolved".
"We've made it clear that for the future we're not on for [investor-state dispute settlement] clauses."
Government leaders will resume their talks this evening New Zealand time.
TPP must be delivered - former Trade Minister
Earlier, Prime Minister Jacinda Ardern said talks were coming down to the wire and she doubted a deal could be done if there was no agreement today.
The talks are an attempt to restore the trade pact that suffered a huge setback when the United States president Donald Trump pulled his country out of any deal.
Japan then took over leadership.
National MP and former Trade Minister Todd McClay said it was critical to conclude the deal before the summit's end.
"When we travelled the world earlier this year to stitch the agreement back together it was always about making a decision in APEC this weekend.
"It really must be delivered on for kiwi exporters otherwise they miss out."
Mr McClay said it would be difficult for Labour to get a lot of the changes it wanted, but was backing the new government to get the best deal possible.