(Reuters) - The Nasdaq closed at a record high for the second day in a row with help from the technology and consumer discretionary sectors, while the S&P 500 edged higher as investors eyed solid U.S. economic data.

However, bank stocks declined along with U.S. Treasury yields, and investors appeared to favor bonds over defensive equity sectors such as utilities and consumer staples.

The U.S. services sector activity accelerated in May, pointing to robust economic growth in the second quarter, although trade tariffs and a shortage of workers posed a threat to the outlook.

“The economy continues to be a very strong foundation for the stock market. What seems to be concerning markets today is the possibility for a slowdown outside of the United States,” said Tracie McMillion, head of global asset allocation strategy for Wells Fargo Investment Institute, in Winston-Salem, North Carolina.

Investors were hoping for signs of political stability in Italy as the new, anti-establishment government won its first vote of confidence in the upper house Senate and the prime minister promised radical changes, including more generous welfare and a crackdown on immigration.

“Investors are worried about a slowdown in growth in emerging markets and concerned about Italy being able to stabilize its government. The confidence vote should help,” said McMillion.

The Dow Jones Industrial Average fell 13.71 points, or 0.06 percent, to 24,799.98, the S&P 500 gained 1.93 points, or 0.07 percent, to 2,748.8 and the Nasdaq Composite added 31.40 points, or 0.41 percent, to 7,637.86.

The Nasdaq’s biggest boost was from Amazon.com, which rose 1.9 percent, also leading gains in the S&P consumer discretionary index. Apple rose 0.8 percent, contributing the biggest point gains to the technology index and the second biggest for the Nasdaq.

The Cboe Volatility Index, the most widely followed barometer of expected near-term volatility for the S&P 500, closed down 0.34 point at 12.4, its lowest close since Jan. 26.The financial sector was the S&P’s biggest drag with a 0.4 percent decline. Bank of America and Citibank fell around 0.9 percent. Banks often trade in line with Treasury yields as higher rates can boost their profits.

Liz Ann Sonders, chief investment strategist at Charles Schwab Corp in New York, pointed to “very good” U.S. non-manufacturing data released Tuesday but highlighted a “pretty big jump” in the prices paid index, which rose to 64.3 in May from 61.8 in April.

“We are starting to see signs inflation is gaining traction,” Sonders said.

Twitter shares closed up 5.1 percent on news that the social media company would join the benchmark S&P 500 U.S. index, while Netflix rose 1.1 percent after news it would enter the S&P 100 index.

Shares of U.S. packaged food companies fell as Mexico imposes tariffs on sensitive agricultural products from pork to bourbon as well as certain types of cheeses. Kellogg and General Mills each fell around 2 percent.

Advancing issues outnumbered declining ones on the NYSE by a 1.43-to-1 ratio; on Nasdaq, a 1.79-to-1 ratio favored advancers.

The S&P 500 posted 50 new 52-week highs and eight new lows; the Nasdaq Composite recorded 223 new highs and 39 new lows.

Volume on U.S. exchanges was 6.58 billion shares, compared with the 6.64 billion average for the last 20 sessions.