Theresa May will commit a Conservative government to increasing defence spending above inflation every year of the next parliament, as well as meeting Nato’s commitment to spend at least 2% of GDP on defence.

The manifesto pledge would mean that defence spending will increase at least 0.5% above inflation every year, even if the UK is in recession or the economy is hit by the country’s exit from the European Union.

The commitment was originally made in George Osborne’s summer 2016 budget, but the manifesto would extend that pledge for an additional two years until the next election in 2022.

The increase would mean the defence budget will increase by nearly £5bn to £39.7bn by 2020-21. May will also hope the commitment will serve to underline the difference between her and the Labour leader, Jeremy Corbyn, who has expressed some scepticism about the UK’s commitment to the Nato target as well as maintaining the Trident nuclear deterrent.

“As prime minister I always have and always will put Britain’s national security first,” she said in a statement announcing the pledge. “That is why if elected on 8 June I will ensure that the UK continues to spend at least 2% of GDP on defence and that the budget rises every year.”

The Conservatives would “ensure that the brave men and women of our armed forces have the equipment and resources they need to keep our country safe – and that we meet our obligations to the world”, May added.

In another attack on the Labour leader, May said the budget increase would only be possible with a strong economy. “Jeremy Corbyn would put both at risk if he makes it to Downing Street propped up by the Lib Dems and SNP in a coalition of chaos,” she said. Labour has ruled out a coalition with the SNP , while the Liberal Democrats have ruled out anything similar with Labour.

“Only a vote for me and my Conservative team will deliver the strong and stable leadership that is vital for our national security,” May said.

At the last general election, David Cameron came under pressure to make the same commitment to meet the 2% Nato target in the party manifesto, including strong words from then-US president Barack Obama.

The government of the day had faced some criticism, including from the now-Brexit secretary, David Davis, for “creative accounting” in order to meet the target and for focusing the defence budget on intelligence rather than troops and military hardware.

Labour’s shadow defence secretary Nia Griffiths said the pledge would not counteract the real terms cuts to forces’ budgets.

“The severe cuts imposed on the defence budget since 2010 have seen the Army shrink to 78,000, its smallest size since the Napoleonic Wars and far short of the last Tory manifesto pledge to keep it above 82,000,” she said.

Labour was also committed to the NATO target, she added. “Clearly the Tories care more about a day of positive headlines and cheap rhetoric than the safety of our troops.”

Paddy Ashdown, the former Lib Dem leader said: “Of course adequate spending on defence is welcome and necessary, but this is a piece of last-minute chicanery to cover up the Conservative’s dismal record. No wonder Britain’s top generals have accused the Tories of trying to deceive the public over defence cuts.”