Bet on Caterpillar because of the outlook for mining activity, according to analysts at Deutsche Bank and UBS.

Caterpillar Inc. (CAT) rose 1% to $139.62 at 10:15 a.m. New York time on Wednesday, Sept. 5, on positive commentary that suggests further upside for the stock even though trade talks have weighed on it recently.

Deutsche Bank analyst Chad Dillard resumed coverage of the Deerfield, Ill.-based construction machinery and equipment company with a Buy rating and a $177 price target, which implies 30% upside.

Dillard noted that mining and oil and gas producers have "systematically underinvested" in equipment, and Caterpillar stands to benefit over the next few years as these producers ramp up buying to replace aging equipment.

"We estimate mining and oil & gas equipment sales could grow at a 30% and 10% [compound annual growth rate] over the next few years, providing a platform for sustained earnings growth over the next few years," Dillard said.

Separately, UBS analyst Steven Fisher said the UBS Evidence Lab survey, which includes responses from more than 50 mining companies in nine countries, gave him increased confidence that mining will be one of the strongest industrial end markets in 2019, and likely to boost Caterpillar's earnings per share.

"Over 60% of respondents to our survey expect budgets for machinery to increase [year over year] in both 2019 and 2020, with increased focus on automation, and over 80% of respondents expect aftermarket budgets to increase in 2019 as well," Fisher said. "CAT has the largest number of autonomous machines in operation in the mining industry (approximately 250), and continues to invest in autonomy."

Given this outlook, Fisher raised his 2019 and 2020 earnings per share estimates to $13 and $14, respectively. UBS reiterated its Buy rating and its $185 price target.

In addition to the bullish outlook for mining activity, Caterpillar has an attractive valuation, Deutsche Bank's Dillard said. The company's stock has come under pressure, falling about 8% over the past three months, as trade tensions between the U.S. and China and the U.S. and Canada escalate.

"Currently CAT trades at 9x EBITDA or a 40% discount to the S&P 500, marking the largest discount to the index in nearly 20 years that is driven by late-cycle fears," Dillard said. "As the market realizes that CAT can not only continue growing earnings but also increase its returns to shareholders, we expect the stock to re-rate."

There are 17 Buys, 11 Holds and two Sell ratings on the stock, according to Bloomberg data.