Donald Trump has backed away from tariff threats against Mexico and Canada after the US neighbours agreed to boost border security efforts.