Traders work on the floor of the New York Stock Exchange.

Goldman Sachs predicts the markets will not move much into year-end, but some of the firm's clients are saying the S&P 500 could rally sharply higher.

The firm said the second-quarter corporate earnings season was "stellar," with 25 percent year-over-year earnings per share growth and a sales increase of 12 percent.

"The best earnings season since 2010 is now mostly behind us. Investors have quickly shifted their attention from past results to future prospects at both the micro and macro levels," Goldman's chief U.S. equity strategist David Kostin wrote Friday in a note entitled "The most out-of-consensus question we received: What if activity is better than everyone expects?"

"Investors remain concerned about trade and tariffs," the note said, "However, we were surprised this week when several investors actually struck a different chord, positing optimistic scenarios relative to our starting forecast."

Kostin reiterated his year-end price target of 2,850 for the S&P 500, representing 0.6 percent upside from Friday's close.

The strategist looked at what would happen if trade tensions fade, the Federal Reserve stops raising rates after two or three hikes and economic growth continues to rise. Under such a scenario, Goldman's estimate for S&P 500 2019 earnings per share would rise by 3 percent, to $175, and a lower-than-expected Treasury yield would enable a market price to earnings multiple of 18 times. This would lead to a year-end price target for the S&P 500 of 3,150, 11 percent higher than Friday's close.

But even if the market doesn't dramatically rally, Goldman Sachs gave its clients several stock ideas that can outperform in a flat market environment.

"Given our forecast for decelerating US economic growth, investors should focus on stocks providing the fastest top-line growth," he said. "Our sector-neutral basket of S&P 500 stocks with the fastest consensus 2019 sales growth has outperformed S&P 500 by 3 pp this year. Five stocks [in the basket] have more than 25% expected sales growth (Autodesk, Align Technology, Cabot Oil & Gas, Concho Resources, and Facebook)."