After hours of indecisive trading, stocks finished with modest gains on Thursday after President Donald Trump formally ordered tariffs on steel and aluminium imports with terms that were less harsh than investors had feared.

Stocks rallied following reports that Canada and Mexico will be exempted indefinitely from the tariffs and that other countries will be invited to negotiate for exemptions as well.

Congressional Republicans and business leaders oppose the tariffs and have pushed for the administration to take a more measured approach that would invite less backlash from other countries.

Health care companies rose after pharmacy benefits manager Express Scripts accepted a $52 billion offer from health insurer Cigna. Technology companies also moved higher, but energy companies slipped along with oil prices.

The Standard & Poor’s 500 index climbed 12.17 points, or 0.4%, to 2,738.97. The Dow Jones industrial average rose 93.85 points, or 0.4%, to 24,895.21. The Nasdaq composite rose for the fifth day in a row, gaining 31.30 points, or 0.4%, to 7,427.95.

The Russell 2000 index of smaller-company stocks dipped 2.57 points, or 0.2%, to 1,571.97. The index had jumped 4.5% over the previous four days as discussion about the proposed tariffs prompted investors to buy US-focused companies and sell multinational firms.

Friday could prove to be another dramatic day on Wall Street as investors review the government’s February jobs report.

Stocks tumbled after the January report showed unexpectedly strong growth in wages, which set off worries about inflation.

Investors expect February’s jobs report will show another month of strong hiring.

According to FactSet, they expect to see that hourly wages grew 2.8%. That is similar to last month’s report, which caught investors by surprise.

Wall Street feared the stronger wage gains mean inflation is picking up and that interest rates will start to rise more rapidly, slowing the economy.

Bond prices edged higher. The yield on the 10-year Treasury note declined to 2.85% from 2.88%. Banks traded lower, because lower yields mean they cannot make as much money from lending.