Malaysian car importer Weststar has agreed a deal to buy van maker LDV, safeguarding hundreds of jobs.
Weststar wants to buy the Birmingham-based business and invest money in the Washwood Heath plant, which has been at a standstill since before Christmas.
The Government is lending up to £5m as a bridging loan to Weststar while due diligence takes place on LDV.
LDV was due to go into administration on Wednesday, raising fears that the 850 workers would be made redundant
and the jobs of hundreds, if not thousands, of employees at other companies would also be lost.
But sources say that a deal had been signed with Weststar to buy the entire business.
The Department for Business, Enterprise and Regulatory Reform said: "Weststar's proposed purchase of LDV offers the only credible chance of keeping this manufacturing plant in the UK.
"Whilst completion of the deal is not certain, it would have been irresponsible of the Government not to support it going forward. But this is a one-off bridging loan to Weststar and it cannot be extended."
Joe Morgan, an official of the GMB union, said: "We hope that this is welcome news, and we look forward to talking to the new owners as soon as we can to find out what their plans are."
Sky's Midlands correspondent David Crabtree said: "We could be looking at the Great Escape, it really is a last-minute rescue effort. Only today we were filming here as workers collected what they thought would be their last pay packet.
"LDV has a good product, a brand new all-electric van. It has all the green credentials. Something like £500m was spent developing that. LDV hoped that would make it very much a company of the future and I think Weststar has seen that.
"There are still the Ts to cross but there's great optimism here tonight."
Labour MP Geoffrey Robinson, a former chairman of Jaguar, told Sky's Jeff Randall Live: "It'll need investment, number one, to make LDV viable and that should be put as a top priority into the development of the electric van.
"If they can capitalise on that and if they have the government's goodwill and the backing that's necessary, and if Weststar can come up with the fundamental investment that's needed they've got a fighting chance."
Directors of LDV announced last week that they had applied for administration, saying that the case was going to be heard this Wednesday.
The company has not built any vans since before Christmas, after its Russian owner, Gaz, decided to sell the business.
Workers were told they could not be guaranteed that they would be paid from this week, but the surprise announcement looks like safeguarding jobs.
A planned management buyout of LDV failed to materialise, and the company has been trying to raise money from overseas investors for the past few months.
The factory has been lying idle for months, and the few workers who remained were sent home last week, saying their situation had been a "nightmare".