NEW YORK (Reuters) - Wall Street limped into positive territory on Wednesday on optimism over a spate of upbeat earnings that was nearly offset by jitters over rising U.S. bond yields and corporate costs.

The S&P 500 and the Dow Jones Industrial Average ended up after a choppy session, with the Dow ending a five-day losing streak, but the Nasdaq posted its fifth straight loss, weighed down by technology stocks.

“Investors are aware that the tax cuts have certainly boosted earnings and they have also seen an increase in top line growth,” said Bernard Baumohl, chief global economist at the Economic Outlook Group in Princeton, New Jersey.

“But we are a bit long in the tooth with respect to this cycle. Interest rates are also moving higher. And at some point there is a question how much longer this economic expansion can continue to grow.”

The 10-year U.S. Treasury yield, a benchmark for global borrowing costs, finished above 3 percent as the supply of government debt surged due to a revenue shortfall following the massive tax overhaul.

Shares of Boeing rose 4.2percent after the company posted better-than-expected profits amid strong commercial airliner sales, leading it to raise its forecasts after a record 2017.

However, Twitter fell 2.4percent after the social media company said it expects a slowdown in revenue growth and increasing costs, putting a damper on its otherwise upbeat earnings report.

“It’s not a mystery why these things are happening,” Baumohl said. “Just imagine what would happen if trade tensions picked up. How would that affect Caterpillar? How would the roughly half of S&P 500 stocks that depend on overseas sales?”

On Tuesday Caterpillar fell 6.2 percent despite its earnings beat, when investors were spooked by the company’s warning of higher costs.

The Dow Jones Industrial Average rose 59.7 points, or 0.25 percent, to 24,083.83, the S&P 500 gained 4.84 points, or 0.18 percent, to 2,639.4 and the Nasdaq Composite dropped 3.62 points, or 0.05 percent, to 7,003.74.

Facebook was up in after-market trading after the social media company reported revenue that beat Wall Street expectations.

Comcast rose 2.7 percent after the largest U.S. cable company confirmed its $31 billion bid for Sky on the heels of its better-than-expected earnings report.

So far, 31 percent of S&P 500 companies have reported earnings, 81.2 percent of which came in above consensus estimates. Analysts now expect first-quarter earnings growth of 22 percent, according to Thomson Reuters data.

Of the 11 major S&P 500 sector indexes, Real Estate, Technology, and Financials ended the session in negative territory.

Declining issues outnumbered advancing ones on the NYSE by a 1.32-to-1 ratio; on Nasdaq, a 1.37-to-1 ratio favored decliners.

Volume on U.S. exchanges was 6.67 billion shares, compared to the 6.75 billion average for the full session over the last 20 trading days.