The stock market will likely erase its 2022 losses in the second half as inflation declines and the U.S. economy skirts a recession, according to a top strategist at JPMorgan. Marko Kolanovic, who has remained bullish on stocks in recent months despite sharp declines, said in a note to clients on Thursday that he and his team expect the S & P 500 to end the year at 4,800. That is 27.7% above where the broad market index closed on Wednesday and a few ticks above its all-time closing high of 4,796.56 reached on Jan. 3. "While the geopolitical tensions in Europe represent a significant risk to the cycle, we believe that a diplomatic solution in 2H22 is likely and should improve the inflation backdrop. JPM Economics is also forecasting inflation to moderate substantially later this year—in effect, reducing the probability of U.S. recession and earnings contraction. This backdrop combined with near record low investor positioning offers an increasingly attractive risk/reward going into 2H, in our view," Kolanovic wrote. JPMorgan remains bullish on the energy sector, which has recently weakened after dramatically outperforming for most of this year, but also suggests buying other cyclical stocks over defensive names. "Anything short of a recession will likely catch most investors completely wrong-footed, especially after broad correction that resulted in the average stock drawdown ~80% of the way to prior recession bottoms," Kolanovic wrote. Recession fears have grown among investors in recent weeks, driven by stubbornly high inflation readings, Federal Reserve interest rate increases and signs of slowing demand in areas such as housing. However, Kolanovic predicted core PCE inflation — the Fed's preferred price measure — will drop to a 2.9% annual rate in the second half, which could allow the central back to moderate its tighter monetary policy. "Our forecast expects the Fed to be largely successful in engineering a soft landing, at least through the end of next year," Kolanovic wrote. Even with that optimism, Kolanovic did say that the risks remain to the downside for growth and upside for inflation, with a recession highly possible further out. JPMorgan models suggest a 63% of a chance of a recession over the next two years, and 81% over the next three years. — CNBC's Michael Bloom contributed to this report.