The prime minister has set out plans to increase defence spending to 2.5% of national income by 2027.