The UK has secured its biggest post-Brexit deal at a tense time for global trade.