The federal and Victorian governments have announced a rescue package for the Alcoa aluminium smelter in Portland, including $30m in federal funds in return for a guarantee it will stay open until at least 2021.

Malcolm Turnbull announced the package with premier Daniel Andrews in Portland, Victoria on Friday. It comes as Alcoa finalised a new four-year power supply agreement with AGL Energy.

The smelter and the future of its 650 workers was at risk after a major power outage in December knocked out more than half of its production capacity.

The Victorian government estimates the smelter creates more than 1,600 supply chain and indirect jobs and contributes $120m to the local area. Alcoa is the region’s largest employer and biggest taxpayer.

Under the agreement with the federal government, Alcoa will receive $30m for capital improvements and repairs to help it return to producing 300,000t of aluminium a year, its output before the outage. It must maintain output of at least 90% of this level.

If the smelter closes or reduces output before July 2019 it will have to repay the full $30m plus interest. If it remains open beyond July 2021 it keeps the money, with several graduated payment points if it closes between those dates.

Turnbull said the government was standing up for Australian manufacturing and export jobs.

“We were determined to make sure that we provided the support that secured your jobs, your future, Portland’s future,” he said addressing workers at the smelter.

Asked whether it signalled a change in stance on industry policy, Turnbull said Alcoa was a “very particular case” because it was a viable business that had been struck by an unlikely “catastrophe” when transmission lines to the plant broke down.

In a statement Andrews and Victorian industry minister, Wade Noonan, said the state would “make a significant contribution over four years to sustain the smelter”.

A spokesman for Noonan refused to disclose the amount of assistance being provided and at the press conference Andrews also refused to say, although it is reportedly more than $200m.

“There is a cost, of course. But it’s more of an investment and it represents value ... for the Victorian taxpayer,” Andrews said, citing the fact the aluminium sector contributed $1bn to Victoria a year.

“We promised Portland workers we would leave no stone unturned in our efforts to keep the smelter open – and we have delivered certainty to thousands of local workers and their families,” he said.

At the press conference Turnbull credited the Australian Workers Union and its state secretary Ben Davis for support of the workers and the agreement.

“This is a great case of governments working together. As Ben Davis said – you never know, it might catch on! Let’s hope so!”