If investors want to perform well, they ought to pay close attention to what research analysts recommend, according to well-known strategist Tom Lee. Then, they should do the exact opposite.

“Our recommendation would be to start buying stocks that are the least liked on Wall Street right now — what we might call contrarian ideas,” Lee, head of research at FundStrat Global Advisors, said Thursday on CNBC’s “Trading Nation.”

Lee points out that the 20 percent of S&P 500 stocks that are “least liked” by analysts (based on ratings compiled by FactSet) tend to outperform the index by 8.7 percent, with an impeccable track record of beating the market.

Interestingly, those “hated” stocks have underperformed so far this year, which Lee calls a “puzzle.”

Yet since he doesn’t believe analysts are doing a better job, or that investors as a group have “suddenly fallen in love with consensus ideas,” Lee thinks that the underperformance is “temporary.”

In fact, it may present an especially attractive opportunity for investors — particularly because the spread between the average rating on the most-liked and least-liked S&P 500 stocks is the greatest it’s been in eight years.

This gap “is the largest since 2009 — and in that year, the least-liked stocks were up 20 percent versus the market,” Lee said Thursday.

In terms of specific stocks to buy, Fundstrat names a few favorite picks, including Exxon Mobil, Staples and Xilinx.

In fact, Xilinx is one of those relative rare stocks which analysts as a group actually expect to drop, based on the median analyst price target complied by FactSet.

Some on the Street stand out as major bears.

“We’ve been recommending Xilinx as a top short idea since the beginning of the year,” Instinet analyst Romit Shah wrote in a note published at the end of January.

Shah explained that high valuations, declining market share and the company’s inability to capture the opportunities in artificial intelligence all lead him to rate the stock reduce.