Here are Goldman’s favorite stocks for the rest of 2017

  • Goldman told its clients to buy technology and financial stocks, predicting both sectors will outperform the market the rest of the year.
  • The firm's year-end price target for the S&P 500 is 2,400, representing 3 percent downside from Friday's close.

Goldman Sachs says the market will decline the rest of the year, but there are still stocks and sectors that will post strong returns.

The firm recommended technology and financial companies in a note to clients Friday.

Strategist David Kostin's year-end price target for the S&P 500 is 2,400, representing 3 percent downside from Friday's close.

"Put simply, growth will drive technology share prices higher while change in growth will support the performance of financials. ... We expect both sectors will outperform going forward, but for different reasons," Kostin wrote in the report.

"The tech sector will benefit from robust expected sales growth relative to the rest of the market while the prospect of higher interest rates and the ability to return capital to shareholders will benefit financials," he added.

The strategist estimated the technology sector will increase its sales by 9 percent this year and 7 percent in 2018 "far exceeding the rest the market's" low single-digit growth rate. He said Goldman's research analysts predict Facebook, Amazon and Alphabet "will lead the way" with sales growth of more than 20 percent.

"During periods of modest economic growth, investors gravitate to the scarce commodity: stocks with secular growth prospects," he wrote.

Alphabet is slated to report second-quarter earnings after Monday's close. Facebook and Amazon are scheduled to announce financial results on Wednesday and Thursday, respectively.

Kostin also cited how financial companies will raise dividend and stock buybacks to $132 billion from $92 billion after the big banks all passed the Federal Reserve's stress test last month.

The strategist estimated the banking sector will raise its dividends by 21 percent on average this year versus 6 percent for the S&P 500, boosting financials' share prices.

— CNBC's Michael Bloom contributed to this story.

WATCH: What's working: Three 'scary' tech plays if you want appreciation