Jan 2 (Reuters) - U.S. stocks rose on Tuesday in the first session of the new year as investors were optimistic that 2018 will bring more gains for the market.

Gains were driven the most by technology, though consumer discretionary, healthcare, energy and materials sectors were also up more than 1 percent each.

Apple, Facebook, Alphabet and Microsoft pulled the technology index higher, following a 37-percent surge in 2017 that made it the best performing S&P sector.

Major stock indexes closed out 2017 with their best performances since 2013. Many investors say the rally could continue this year with the help of a U.S. tax overhaul that is anticipated to boost profits as well as the economy.

“When you look at the sentiment indicators ... We’re starting to see sentiment really pick up. Our best guess is the first quarter or half of the year can be OK as a continuation of last year,” said Paul Nolte, portfolio manager at Kingsview Asset Management in Chicago.

But, he said, there are risks ahead. “Valuations are still stretched, interest rates are still rising, and those will provide headwinds to the market at some point.”

The Dow Jones Industrial Average rose 61.04 points, or 0.25 percent, to 24,780.26, the S&P 500 gained 17.53 points, or 0.66 percent, to 2,691.14 and the Nasdaq Composite added 92.43 points, or 1.34 percent, to 6,995.82.

The S&P consumer discretionary index was up 1.5 percent, helped by a gain in Amazon.com.

J.C. Penney, Nordstrom and Kohl’s climbed after a bullish Citigroup note on the retail sector detailed benefits from the corporate tax cuts.

Energy shares were up even though oil prices dipped. Oil hovered near mid-2015 highs amid large anti-government rallies in major exporter Iran and ongoing supply cuts led by OPEC and Russia.

Advancing issues outnumbered declining ones on the NYSE by a 1.44-to-1 ratio; on Nasdaq, a 1.88-to-1 ratio favored advancers. (Additional reporting by Sruthi Shankar in Bengaluru; Editing by Sriraj Kalluvila and Nick Zieminski)