By Anna Hirtenstein and Gunjan Banerji

An increasingly optimistic outlook on the U.S. economy led investors to dump government bonds and pile into economically sensitive sectors of the stock market on Friday.

The S&P 500 ticked higher 0.2%. The Nasdaq Composite added 0.4%. The Dow Jones Industrial Average added around 88 points, or 0.3%.

In bond markets, the yield on the 10-year Treasury note rose to 1.335%, from 1.286% on Thursday.

The jump in stocks and bond yields comes as fresh economic data has stoked enthusiasm about the U.S. recovery. On Friday, new data showed that business activity in the U.S. private sector held up, boosted by accelerating service activity and manufacturing output. That followed a report Wednesday that showed consumers used stimulus checks to boost retail spending in January to the largest increase in seven months. Some economists have increased estimates of gross domestic product for the first quarter of the year.

JPMorgan Chase & Co. strategists said Friday that they expect consumers to shatter expectations for the rest of the year given expected fiscal stimulus and economic reopening as the pandemic eases. Meanwhile, Federal Reserve Bank of Boston President Eric Rosengren said he expects the economy to pick up steam this year as vaccines as distributed.

This optimistic outlook led investors to ditch Treasurys and pile into economically sensitive sectors like financials and energy on Friday, leading those sectors to outperform their peers. The Russell 2000 index of small stocks advanced 1.6%, surpassing the slim gains of other major indexes.

But the climb in bond yields this week has also prompted some investors to question whether risky assets such as stocks are looking less attractive, said Kiran Ganesh, a multiasset strategist at UBS Global Wealth Management.

"A main driver for equity markets over the past few months has been a lack of competition," Mr. Ganesh said. "If yields rise, then we could see some people rotating away from growth names and toward credit or bonds."

Stocks have come under pressure in recent days as high valuations for technology stocks and rising bond yields weighed on sentiment. The Dow is on course for a modest gain for the week, while the S&P 500 and Nasdaq Composite are set for slight losses.

"Investors are taking a little bit of a pause," said Arthur van Slooten, global asset allocation strategist at Société Générale. "We believe there is further to go. When the reflation trade is back on and there is more confidence about this, we'll see a continuation of the market performance that we've had" in recent weeks, he added.

In corporate news, agricultural equipment maker Deere jumped about 10% in after saying it expects solid profit growth in 2021.

Oil prices pulled back after U.S. diplomats said Thursday evening that they may meet with Iran officials for nuclear talks in the coming weeks, prompting speculation that a deal could allow Iran to begin exporting more crude. Brent crude declined 1.5% to $62.99 a barrel and the U.S. benchmark, West Texas Intermediate, fell 1.9% to $59.36.

Investors are closely watching "how quickly Iran could re-enter the market," said Bjarne Schieldrop, chief commodities analyst at Nordic bank SEB. The country is expected to add between 2 million and 3 million barrels a day to global production if sanctions are lifted, he said.

Overseas, the pan-continental Stoxx Europe 600 climbed 0.5%.

In Asia, major stock benchmarks were mixed. The Shanghai Composite Index closed up 0.6%, while Japan's Nikkei 225 retreated 0.7%.

Write to Anna Hirtenstein at anna.hirtenstein@wsj.com and Gunjan Banerji at Gunjan.Banerji@wsj.com

(END) Dow Jones Newswires

02-19-21 1046ET