Caterpillar raised its profit forecast for the year as it reported that second-quarter profits more than doubled from a year ago, beating analysts estimates.

The company said rising commodities prices boosted machinery sales, particularly in North America. Rising demand and a much lower tax rate were more than enough to offset increased metals costs related tariffs. Shares rose by more than 3 percent in premarket trading.

The world’s largest manufacturer of equipment for energy and construction firms reported sales rose 24 percent to $14.01 billion. Second-quarter profits doubled from a year ago to $1.71 billion, or $2.82 a share. On an adjusted basis, which how Wall Street analysts tend to view performance, earnings rose to $2.97 per share. Analysts had forecast adjusted profits for $2.73 per share on $13.88 billion of sales.

The company boosted its full-year profit forecast to between $11 and $12 a share, on an adjusted basis, up from $10.25 to $11.25. Without adjustments, which mostly arise from restructuring costs from the sales of old businesses, the company raised 2018 profit per share outlook to a range of $10.50 to $11.50 from $9.75 to $10.75.

Higher commodity prices gave a lift to sales as Caterpillar’s mining customers boosted demand for machinery related to oil and gas, particularly in North America. Rising construction and infrastructure investment in China lifted sales in Asia.

The company said the Trump administration’s tariffs to increase raw material costs in the remainder of 2018 by about $100 million to $200 million. But it expects to offset much of those increased costs with price increases.

Higher prices for steel and aluminum, however, were more than offset by the benefits of the Trump administration’s tax cuts. Its expense for income taxes in the second quarter of 2018 are based on an estimated annual tax rate of 24 percent, compared to 32 percent for the second quarter of 2017. At the higher rate, the tax bill for the quarter would have been around $200 million higher, according to data provided by the company.

“The decrease was primarily due to the reduction in the U.S. corporate tax rate beginning January 1, 2018, along with other changes in the geographic mix of profits from a tax perspective,” the company said.

The company also said higher freight costs also weighed on profits and that these are expected to continue for the year. It cited widely reported trucker shortages and higher fuel costs as contributing to this.